From 94d642c4de916c2d3a9f4c2cd9c60413cf3ebe27 Mon Sep 17 00:00:00 2001 From: Cloud Date: Mon, 22 Jan 2024 10:59:34 +0800 Subject: [PATCH] feat: modify editor config realtime --- .../content_value/ContentEditor.vue | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/frontend/src/components/content_value/ContentEditor.vue b/frontend/src/components/content_value/ContentEditor.vue index 5c0da2f..642d45d 100644 --- a/frontend/src/components/content_value/ContentEditor.vue +++ b/frontend/src/components/content_value/ContentEditor.vue @@ -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(() => { destroyEditor() })