Skip to content

Commit af65939

Browse files
authored
Merge pull request ZToolsCenter#598 from LowProfile666/plugin/devbox
2 parents fa20085 + 317565f commit af65939

6 files changed

Lines changed: 45 additions & 36 deletions

File tree

‎plugins/devbox/CHANGELOG.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
本文件记录 ZTools 开发百宝箱插件的版本变更历史。
44

5+
## 2.7.3 - 2026-09-21
6+
7+
### 优化
8+
9+
- **JSON 工具**:状态栏合并为一行并移到编辑器上方——左侧显示 JSON 状态(✓ 有效 JSON / ⚠ 非标准 JSON(可自动修复)/ ✗ 无效 JSON),随后是操作状态(如「压缩成功」或错误信息,超长自动省略并悬浮展示全文),右侧保留字符/行数统计;原编辑器下方的操作状态条与统计条随之移除
10+
- **JSON 工具**:编辑框高度改为弹性撑满插件窗口剩余空间(原写死 440px,底部留白),树形视图同样撑满
11+
512
## 2.7.2 - 2026-09-17
613

714
### 修复

‎plugins/devbox/README.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
## 最近更新
88

9+
### v2.7.3 (2026-09-21)
10+
11+
- 优化 **JSON 工具** 状态栏:JSON 状态 + 操作状态合并为一行,显示在编辑器上方(JSON 状态在前、操作状态在后,右侧保留字符/行数统计);编辑框改为弹性撑满插件窗口剩余高度,消除底部留白。
12+
913
### v2.7.2 (2026-09-17)
1014

1115
- 修复 **JSON 工具** 两类粘贴报错:①「无外层引号、内部全是 `\"` 转义」的 JSON(从日志/字符串字面量复制的常见形态)自动还原转义;②「多个对象/数组拼接、缺外层 `[]`」——逗号分隔(`{...},{...}`)或无逗号直连(`{...}{...}`)均可,自动补全逗号与外层数组,直接可格式化、压缩、去转义。状态栏三态显示:有效 JSON(绿)/ 非标准 JSON 可自动修复(黄)/ 无效 JSON(红)。

‎plugins/devbox/index.png‎

155 KB
Loading

‎plugins/devbox/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "myPlugins",
3-
"version": "2.7.2",
3+
"version": "2.7.3",
44
"description": "开发百宝箱,提供随机生成、Base64 编解码、URL 编解码、加密签名、二维码、文本压缩、开发辅助等常用工具集",
55
"type": "module",
66
"scripts": {

‎plugins/devbox/public/plugin.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"categories": ["development"],
66
"description": "开发百宝箱,提供随机生成、Base64 编解码、URL 编解码、加密签名、二维码、文本压缩、文本转换、JSON 工具、开发辅助等常用工具集",
77
"author": "咖啡八杯",
8-
"version": "2.7.2",
8+
"version": "2.7.3",
99
"main": "index.html",
1010
"preload": "preload/services.js",
1111
"logo": "logo.png",

‎plugins/devbox/src/tools/JsonTool/index.vue‎

Lines changed: 32 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,19 @@ if ((window as any).ztools?.onPluginEnter) {
475475
</div>
476476
</div>
477477

478+
<!-- 状态行:JSON 状态在前,操作状态在后,一行显示在编辑器上方 -->
479+
<div v-if="hasContent || errorMsg || statusMsg" class="status-line">
480+
<span v-if="hasContent && isValid && !needsRepair" class="json-status valid">✓ 有效 JSON</span>
481+
<span v-else-if="hasContent && needsRepair" class="json-status repair">⚠ 非标准 JSON(可自动修复)</span>
482+
<span v-else-if="hasContent" class="json-status invalid">✗ 无效 JSON</span>
483+
<span v-if="errorMsg" class="op-status error" :title="errorMsg">
484+
<el-icon class="status-icon"><Warning /></el-icon>
485+
<span class="op-text">{{ errorMsg }}</span>
486+
</span>
487+
<span v-else-if="statusMsg" class="op-status success">{{ statusMsg }}</span>
488+
<span v-if="stats" class="stats">{{ stats.chars }} 字符 · {{ stats.lines }} 行</span>
489+
</div>
490+
478491
<!-- 内容区 -->
479492
<div class="content-area">
480493
<!-- 编辑视图:CodeMirror 6 -->
@@ -507,37 +520,25 @@ if ((window as any).ztools?.onPluginEnter) {
507520
<div v-else class="empty-hint">内容非有效 JSON,无法生成树形视图</div>
508521
</div>
509522
</div>
510-
511-
<div v-if="statusMsg || errorMsg" class="status-bar" :class="{ error: !!errorMsg, success: !errorMsg }">
512-
<el-icon v-if="errorMsg" class="status-icon"><Warning /></el-icon>
513-
<span>{{ errorMsg || statusMsg }}</span>
514-
</div>
515-
516-
<div v-if="stats" class="stats-bar">
517-
<span>{{ stats.chars }} 字符 · {{ stats.lines }} 行</span>
518-
<span v-if="isValid && !needsRepair" class="valid-tag">✓ 有效 JSON</span>
519-
<span v-else-if="needsRepair" class="repair-tag">⚠ 非标准 JSON(可自动修复)</span>
520-
<span v-else-if="hasContent" class="invalid-tag">✗ 无效 JSON</span>
521-
</div>
522523
</div>
523524
</template>
524525

525526
<style scoped>
526-
.json-tool { padding: 12px; max-width: 820px; margin: 0 auto; font-size: 13px; }
527-
h2 { margin: 0 0 4px; font-size: 20px; font-weight: 600; }
528-
.desc { color: #909399; margin: 0 0 12px; font-size: 13px; }
527+
.json-tool { padding: 12px; max-width: 820px; margin: 0 auto; font-size: 13px; height: 100%; box-sizing: border-box; display: flex; flex-direction: column; overflow: hidden; }
528+
h2 { margin: 0 0 4px; font-size: 20px; font-weight: 600; flex-shrink: 0; }
529+
.desc { color: #909399; margin: 0 0 12px; font-size: 13px; flex-shrink: 0; }
529530
530-
.view-bar { display: flex; align-items: center; gap: 12px; flex-wrap: nowrap; margin-bottom: 8px; }
531+
.view-bar { display: flex; align-items: center; gap: 12px; flex-wrap: nowrap; margin-bottom: 8px; flex-shrink: 0; }
531532
.view-bar .view-tabs { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
532533
.view-bar .view-tabs :deep(.el-button) { color: #909399; }
533534
.view-bar .view-tabs :deep(.el-button.active) { color: #667eea; font-weight: 600; }
534535
.view-bar .ops { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; flex: 1; min-width: 0; }
535536
.view-bar .view-actions { display: flex; gap: 4px; flex-shrink: 0; }
536537
537-
.content-area { margin-bottom: 10px; }
538+
.content-area { flex: 1; min-height: 0; display: flex; flex-direction: column; margin-bottom: 0; }
538539
539540
/* === CodeMirror 编辑器容器 === */
540-
.cm-editor-host { height: 440px; border: 1px solid var(--border-color, #dcdfe6); border-radius: 6px; overflow: hidden; background: var(--bg-main, #fff); }
541+
.cm-editor-host { flex: 1; min-height: 0; border: 1px solid var(--border-color, #dcdfe6); border-radius: 6px; overflow: hidden; background: var(--bg-main, #fff); }
541542
.cm-editor-host :deep(.cm-editor) { height: 100%; font-size: 13px; }
542543
.cm-editor-host :deep(.cm-editor.cm-focused) { outline: none; }
543544
.cm-editor-host :deep(.cm-scroller) { font-family: 'Consolas', 'Courier New', monospace; line-height: 1.6; }
@@ -548,7 +549,7 @@ h2 { margin: 0 0 4px; font-size: 20px; font-weight: 600; }
548549
/* 语法错误提示(lint tooltip)层级提升,避免被容器裁剪 */
549550
.cm-editor-host :deep(.cm-tooltip) { z-index: 100; }
550551
551-
.readonly-view { border: 1px solid var(--border-color, #dcdfe6); border-radius: 6px; background: var(--bg-main, #fff); max-height: 440px; overflow-y: auto; }
552+
.readonly-view { flex: 1; min-height: 0; border: 1px solid var(--border-color, #dcdfe6); border-radius: 6px; background: var(--bg-main, #fff); overflow-y: auto; }
552553
.empty-hint { padding: 32px 14px; text-align: center; color: #909399; font-size: 12px; }
553554
.truncated-hint { padding: 8px 12px; text-align: center; color: #e6a23c; font-size: 12px; border-top: 1px solid var(--border-color, #eee); }
554555
@@ -573,15 +574,17 @@ h2 { margin: 0 0 4px; font-size: 20px; font-weight: 600; }
573574
.tree-type.tv-array { background: #f0e6ff; color: #6f42c1; }
574575
.tree-type.tv-object { background: #f0f0f0; color: #606266; }
575576
576-
.status-bar { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 6px; margin-bottom: 8px; font-size: 12px; }
577-
.status-bar.success { background: #f0f9eb; color: #67c23a; }
578-
.status-bar.error { background: #fef0f0; color: #f56c6c; }
579-
.status-icon { font-size: 14px; }
580-
581-
.stats-bar { display: flex; gap: 16px; padding: 6px 12px; font-size: 12px; color: #909399; }
582-
.valid-tag { color: #67c23a; }
583-
.repair-tag { color: #e6a23c; }
584-
.invalid-tag { color: #f56c6c; }
577+
.status-line { display: flex; align-items: center; gap: 12px; min-width: 0; margin-bottom: 8px; font-size: 12px; flex-shrink: 0; }
578+
.json-status { flex-shrink: 0; font-weight: 600; }
579+
.json-status.valid { color: #67c23a; }
580+
.json-status.repair { color: #e6a23c; }
581+
.json-status.invalid { color: #f56c6c; }
582+
.op-status { display: flex; align-items: center; gap: 4px; min-width: 0; overflow: hidden; }
583+
.op-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
584+
.op-status.success { color: #67c23a; }
585+
.op-status.error { color: #f56c6c; }
586+
.status-icon { font-size: 14px; flex-shrink: 0; }
587+
.stats { margin-left: auto; color: #909399; flex-shrink: 0; }
585588
586589
@media (prefers-color-scheme: dark) {
587590
.desc { color: #8a8a8a; }
@@ -611,12 +614,7 @@ h2 { margin: 0 0 4px; font-size: 20px; font-weight: 600; }
611614
.tree-type.tv-array { background: #2e1a3a; color: #c678dd; }
612615
.tree-type.tv-object { background: #3a3a3a; color: #aaa; }
613616
.tree-toggle { color: #8a8a8a; }
614-
.status-bar.success { background: #1a2e1a; color: #67c23a; }
615-
.status-bar.error { background: #2e1a1a; color: #f56c6c; }
616-
.stats-bar { color: #8a8a8a; }
617-
.valid-tag { color: #67c23a; }
618-
.repair-tag { color: #d19a66; }
619-
.invalid-tag { color: #f56c6c; }
617+
.stats { color: #8a8a8a; }
620618
h2 { color: #e0e0e0; }
621619
}
622620
</style>

0 commit comments

Comments
 (0)