@@ -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 : 10 px ; }
538+ .content-area { flex : 1 ; min-height : 0 ; display : flex ; flex-direction : column ; margin-bottom : 0 ; }
538539
539540/* === CodeMirror 编辑器容器 === */
540- .cm-editor-host { height : 440 px ; 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 : 440 px ; 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