From c8a9a63dcb2b452c5feb7cce12b4b8ba921bdb49 Mon Sep 17 00:00:00 2001 From: fofolee Date: Mon, 23 Dec 2024 13:31:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E7=BC=96=E6=8E=92=E7=9A=84?= =?UTF-8?q?=E6=8F=92=E5=85=A5=E3=80=81=E5=BA=94=E7=94=A8=E3=80=81=E8=BF=90?= =?UTF-8?q?=E8=A1=8C=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/CommandEditor.vue | 12 +++- src/components/editor/CommandLanguageBar.vue | 56 ++++++++----------- .../editor/composer/CommandComposer.vue | 15 ++--- 3 files changed, 40 insertions(+), 43 deletions(-) diff --git a/src/components/CommandEditor.vue b/src/components/CommandEditor.vue index 08c3f6f..97170ca 100644 --- a/src/components/CommandEditor.vue +++ b/src/components/CommandEditor.vue @@ -38,7 +38,7 @@ @program-changed="programChanged" @run="runCurrentCommand" @save="saveCurrentCommand" - @add-action="insertText" + @use-composer="handleComposer" /> @@ -196,6 +196,16 @@ export default { insertText(text) { this.$refs.editor.repacleEditorSelection(text); }, + handleComposer({ type, code }) { + switch (type) { + case "run": + return this.runCurrentCommand(code); + case "insert": + return this.insertText(code); + case "apply": + return this.$refs.editor.setEditorValue(code); + } + }, // 保存 saveCurrentCommand(message = "保存成功") { let updatedData = this.$refs.sidebar?.SaveMenuData(); diff --git a/src/components/editor/CommandLanguageBar.vue b/src/components/editor/CommandLanguageBar.vue index cab6f90..877ef34 100644 --- a/src/components/editor/CommandLanguageBar.vue +++ b/src/components/editor/CommandLanguageBar.vue @@ -39,8 +39,8 @@ @@ -162,17 +163,16 @@ - + + @@ -180,15 +180,15 @@