@@ -2,9 +2,9 @@ import { defineStore } from 'pinia'
22
33interface JsonEditorTab {
44 code : string
5- settings : {
6- autoDecodeUnicode : boolean
7- }
5+ compareMode : boolean // 是否处于对比模式
6+ compareCode : string // 对比模式下的第二个编辑器内容
7+ syncScroll : boolean // 是否同步滚动
88}
99
1010interface JsonEditorTabs {
@@ -13,6 +13,8 @@ interface JsonEditorTabs {
1313
1414interface XmlEditorTab {
1515 code : string
16+ compareMode : boolean // 是否处于对比模式
17+ compareCode : string // 对比模式下的第二个编辑器内容
1618 settings : {
1719 autoFormat : boolean
1820 }
@@ -46,18 +48,24 @@ export const useToolsStore = defineStore('tools', {
4648 xmlEditorTabs : < XmlEditorTabs > {
4749 default : {
4850 code : '' ,
51+ compareMode : false ,
52+ compareCode : '' ,
4953 settings : {
5054 autoFormat : false
5155 }
5256 }
5357 } ,
5458 currentXmlEditorTab : 'default' ,
59+ // JSON 编辑器全局设置
60+ jsonEditorSettings : {
61+ autoDecodeUnicode : false
62+ } ,
5563 jsonEditorTabs : < JsonEditorTabs > {
5664 default : {
5765 code : '' ,
58- settings : {
59- autoDecodeUnicode : false
60- }
66+ compareMode : false ,
67+ compareCode : '' ,
68+ syncScroll : true
6169 }
6270 } ,
6371 currentJsonEditorTab : 'default' ,
@@ -171,9 +179,9 @@ export const useToolsStore = defineStore('tools', {
171179 const id = Date . now ( ) . toString ( )
172180 this . jsonEditorTabs [ id ] = {
173181 code : '' ,
174- settings : {
175- autoDecodeUnicode : false
176- }
182+ compareMode : false ,
183+ compareCode : '' ,
184+ syncScroll : true
177185 }
178186 return id
179187 } ,
@@ -184,6 +192,8 @@ export const useToolsStore = defineStore('tools', {
184192 const id = Date . now ( ) . toString ( )
185193 this . xmlEditorTabs [ id ] = {
186194 code : '' ,
195+ compareMode : false ,
196+ compareCode : '' ,
187197 settings : {
188198 autoFormat : false
189199 }
0 commit comments