feat: modify editor config realtime

This commit is contained in:
Cloud 2024-01-22 10:59:34 +08:00
parent c2c1e9cfba
commit 94d642c4de
1 changed files with 44 additions and 0 deletions

View File

@ -150,6 +150,50 @@ watch(
}, },
) )
watch(
() => pref.editorFont.fontSize,
(fontSize) => {
if (editorNode != null) {
editorNode.updateOptions({
fontSize,
})
}
},
)
watch(
() => pref.editorFont.fontFamily,
(fontFamily = undefined) => {
if (editorNode != null) {
editorNode.updateOptions({
fontFamily,
})
}
},
)
watch(
() => pref.showLineNum,
(showLineNum) => {
if (editorNode != null) {
editorNode.updateOptions({
lineNumbers: showLineNum ? 'on' : 'off',
})
}
},
)
watch(
() => pref.showFolding,
(showFolding) => {
if (editorNode != null) {
editorNode.updateOptions({
folding: showFolding !== false,
})
}
},
)
onUnmounted(() => { onUnmounted(() => {
destroyEditor() destroyEditor()
}) })