diff --git a/public/logo/quickcommand.png b/public/logo/quickcommand.png index 623b258..7c48809 100644 Binary files a/public/logo/quickcommand.png and b/public/logo/quickcommand.png differ diff --git a/src/components/CommandEditor.vue b/src/components/CommandEditor.vue index d1e5dbe..29c8ccd 100644 --- a/src/components/CommandEditor.vue +++ b/src/components/CommandEditor.vue @@ -213,22 +213,22 @@ export default { window.commandEditor = this; this.bindKeys(); let quickCommandInfo = - this.action.type === "edit" - ? this.action.data - : this.$utools.getDB(this.$utools.DBPRE.CFG + "codeHistory"); + this.action.type === "run" + ? this.$utools.getDB(this.$utools.DBPRE.CFG + "codeHistory") + : this.action.data; Object.assign( this.quickcommandInfo, JSON.parse(JSON.stringify(quickCommandInfo)) ); // monoca 相关 + this.$refs.editor.setEditorValue(this.quickcommandInfo.cmd); this.setLanguage(this.quickcommandInfo.program); - this.$refs.editor.setEditorValue(quickCommandInfo.cmd); // 默认命令不可编辑 if (this.quickcommandInfo.tags?.includes("默认") && !utools.isDev()) { this.canCommandSave = false; } - // 只有新建或运行时才保存记录 - if (this.action.type === "edit") return; + // 只有 runCode 时才保存记录 + if (this.action.type !== "run") return; utools.onPluginOut(() => { this.quickcommandInfo.cmd = this.$refs.editor.getEditorValue(); // 保存本次编辑记录 @@ -402,6 +402,7 @@ export default { this.runResult += htmlEncode(content, raw); }, closeEditor() { + this.$refs.editor?.destoryEditor(); this.$emit("editorEvent", { type: "close", data: {}, diff --git a/src/components/CommandMenu.vue b/src/components/CommandMenu.vue index baee71c..92fa2e4 100644 --- a/src/components/CommandMenu.vue +++ b/src/components/CommandMenu.vue @@ -159,6 +159,14 @@ + + 注意需要自行在变量两边加上引号,如"{{ scope.opt.label }}" + + + 需要自行对json进行处理,如json.loads(r"""{{ + scope.opt.label + }}""") + {{ scope.opt.desc }} @@ -259,11 +267,10 @@ export default { }, computed: { specialVarsOptions() { - let x= Object.values(specialVars).filter( + let x = Object.values(specialVars).filter( (x) => !x.label.match(this.cmdType.disabledSpecialVars) ); - console.log(x); - return x + return x; }, }, methods: { diff --git a/src/components/MonocaEditor.vue b/src/components/MonocaEditor.vue index 0cef5b0..de828f8 100644 --- a/src/components/MonocaEditor.vue +++ b/src/components/MonocaEditor.vue @@ -168,6 +168,9 @@ export default { }; this.rawEditor.executeEdits("my-source", [op]); }, + destoryEditor() { + this.rawEditor.dispose(); + }, }, }; diff --git a/src/js/options/specialVars.js b/src/js/options/specialVars.js index f40c5d9..c219b07 100644 --- a/src/js/options/specialVars.js +++ b/src/js/options/specialVars.js @@ -1,9 +1,4 @@ const specialVars = { - isWin: { - name: "isWin", - label: "{{isWin}}", - desc: "是否Window系统, 返回1或0" - }, LocalId: { name: "LocalId", label: "{{LocalId}}", @@ -37,7 +32,8 @@ const specialVars = { WindowInfo: { name: "WindowInfo", label: "{{WindowInfo}}", - desc: "当前窗口信息,JSON格式" + desc: "当前窗口信息,JSON格式字符串", + type: "json" }, SelectFile: { name: "SelectFile", @@ -47,7 +43,8 @@ const specialVars = { MatchedFiles: { name: "MatchedFiles", label: "{{MatchedFiles}}", - desc: "匹配的文件,JSON格式" + desc: "匹配的文件,JSON格式字符串", + type: "json" }, type: { name: "type", @@ -57,7 +54,8 @@ const specialVars = { payload: { name: "payload", label: "{{payload}}", - desc: "专业模式的payload,JSON格式" + desc: "专业模式的payload,JSON格式字符串", + type: "json" } } diff --git a/src/pages/ConfigurationPage.vue b/src/pages/ConfigurationPage.vue index 72ec5d9..d98d2bb 100644 --- a/src/pages/ConfigurationPage.vue +++ b/src/pages/ConfigurationPage.vue @@ -141,8 +141,10 @@ 按四列排列的面板视图
老版本的「快捷面板」已被弃用,取而代之的是新版的「面板视图」
- 面板视图下只显示图标、描述和匹配类型,且不显示匹配类型为窗口的命令
- 点击卡片时会直接运行命令而不是编辑命令
+ 1.未启用、匹配类型为窗口的命令在此视图下不显示
+ 2.只显示图标、描述和匹配类型
+ 3.点击卡片时会直接运行命令而不是编辑命令