From 729b165d24b51a4ee990ee8b1593058f453036c8 Mon Sep 17 00:00:00 2001 From: baiy Date: Sat, 30 Oct 2021 13:45:49 +0800 Subject: [PATCH] =?UTF-8?q?#90=20fix=20=E6=92=A4=E9=94=80=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 参考: --- src/views/tool/components/codeEditor.vue | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/views/tool/components/codeEditor.vue b/src/views/tool/components/codeEditor.vue index e27fd73..6614391 100644 --- a/src/views/tool/components/codeEditor.vue +++ b/src/views/tool/components/codeEditor.vue @@ -58,7 +58,17 @@ export default { watch: { value(newValue) { if (this.editor !== null && this.editor.getValue() !== newValue) { - this.editor.setValue(newValue) + this.editor.pushUndoStop(); + this.editor.getModel().pushEditOperations( + [], + [ + { + range: this.editor.getModel().getFullModelRange(), + text: newValue, + }, + ] + ); + this.editor.pushUndoStop(); } }, language(newValue) { -- GitLab