From 7f3eb2db49fde702fce89e1f708b0b0e5e7b3a3c Mon Sep 17 00:00:00 2001 From: lirui Date: Mon, 9 Feb 2026 20:40:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=BC=BA=20JSON=20=E9=A2=84=E8=A7=88?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=EF=BC=8C=E6=94=AF=E6=8C=81=E6=89=8B=E5=8A=A8?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=92=8C=E9=9D=A2=E6=9D=BF=E6=8B=96=E5=8A=A8?= =?UTF-8?q?=E8=B0=83=E6=95=B4=EF=BC=9B=E4=BC=98=E5=8C=96=20Excel=20?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=A7=A3=E6=9E=90=EF=BC=8C=E8=BF=87=E6=BB=A4?= =?UTF-8?q?=E7=A9=BA=E5=88=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib/components/JsonPreview.svelte | 114 ++++++++++++++++++++++---- src/lib/excel.ts | 16 +++- src/routes/+page.svelte | 96 ++++++++++++++++++++-- 3 files changed, 201 insertions(+), 25 deletions(-) diff --git a/src/lib/components/JsonPreview.svelte b/src/lib/components/JsonPreview.svelte index fdd97aa..fd2e198 100644 --- a/src/lib/components/JsonPreview.svelte +++ b/src/lib/components/JsonPreview.svelte @@ -1,13 +1,39 @@
@@ -27,21 +76,44 @@ JSON 预览 {json.length} 条记录 -
- +
+ {#if editing} + + + {:else} + + {/if}
-
- {#if collapsed} -
{JSON.stringify(json)}
+ {#if parseError} +
{parseError}
+ {/if} + +
+ {#if editing} + + {:else} -
{@html highlight(jsonString)}
+
+
{@html highlight(truncated.text)}
+ {#if truncated.isTruncated} +
+ ⚠️ 预览已截断以提升性能(显示 {Math.min(MAX_PREVIEW_CHARS, truncated.text.length).toLocaleString()}/{truncated.totalChars.toLocaleString()} 字符,{Math.min(MAX_PREVIEW_LINES, truncated.totalLines)}/{truncated.totalLines.toLocaleString()} 行)。请点击下载或复制查看完整数据。 +
+ {/if} +
{/if}
@@ -49,6 +121,16 @@