精简 monaco 相关代码

This commit is contained in:
fofolee 2022-04-20 15:20:41 +08:00
parent b33f4b16eb
commit 688b3b09f5
4 changed files with 5 additions and 15 deletions

View File

@ -327,13 +327,6 @@ export default {
this.matchLanguage(this.quickcommandInfo.customOptions.ext); this.matchLanguage(this.quickcommandInfo.customOptions.ext);
}); });
}, },
closeEditor() {
this.$refs.editor?.destoryEditor();
this.$emit("editorEvent", {
type: "close",
data: {},
});
},
// //
saveCurrentCommand() { saveCurrentCommand() {
let updatedData = this.$refs.sidebar?.SaveMenuData(); let updatedData = this.$refs.sidebar?.SaveMenuData();
@ -348,7 +341,6 @@ export default {
type: "save", type: "save",
data: newQuickcommandInfo, data: newQuickcommandInfo,
}); });
this.closeEditor();
}, },
// //
runCurrentCommand() { runCurrentCommand() {

View File

@ -14,7 +14,7 @@
color="grey" color="grey"
style="margin-right: 29px" style="margin-right: 29px"
icon="arrow_back_ios_new" icon="arrow_back_ios_new"
@click="$parent.closeEditor" v-close-popup
/> />
<q-img <q-img
class="commandLogo" class="commandLogo"

View File

@ -204,9 +204,6 @@ export default {
}; };
this.rawEditor.executeEdits("my-source", [op]); this.rawEditor.executeEdits("my-source", [op]);
}, },
destoryEditor() {
this.rawEditor.dispose();
},
listenEditorValue() { listenEditorValue() {
this.rawEditor.focus(); this.rawEditor.focus();
this.rawEditor.onDidChangeModelContent(() => { this.rawEditor.onDidChangeModelContent(() => {
@ -237,6 +234,9 @@ export default {
); );
}, },
}, },
beforeUnmount() {
this.rawEditor.dispose();
},
}; };
</script> </script>

View File

@ -576,11 +576,9 @@ export default {
}, },
editorEvent(event) { editorEvent(event) {
switch (event.type) { switch (event.type) {
case "close":
this.isCommandEditorShow = false;
return;
case "save": case "save":
this.saveCommand(event.data); this.saveCommand(event.data);
this.isCommandEditorShow = false;
default: default:
return; return;
} }