mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-09-24 13:03:30 +08:00
完善保存命令功能
This commit is contained in:
@@ -161,7 +161,7 @@ export default {
|
||||
programLanguages: Object.keys(this.$programmings),
|
||||
sideBarWidth: "290px",
|
||||
languageBarHeight: "40px",
|
||||
canCommandSave: this.action.type === "edit" ? true : false,
|
||||
canCommandSave: this.action.type === "code" ? false : true,
|
||||
quickcommandInfo: {
|
||||
features: {
|
||||
explain: "",
|
||||
@@ -202,7 +202,7 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
allQuickCommandTags() {
|
||||
return this.parentPage.allQuickCommandTags.filter(
|
||||
return this.parent.allQuickCommandTags.filter(
|
||||
(x) => x !== "默认" && x !== "未分类" && x !== "搜索结果"
|
||||
);
|
||||
},
|
||||
@@ -407,9 +407,24 @@ export default {
|
||||
},
|
||||
// 保存
|
||||
saveCurrentCommand() {
|
||||
let updatedData = this.$refs.editor.SaveMenuData();
|
||||
let updatedData = this.$refs.menu.SaveMenuData();
|
||||
if (!updatedData) return;
|
||||
_.merge(this.quickcommandInfo, updatedData);
|
||||
Object.assign(this.quickcommandInfo, _.cloneDeep(updatedData));
|
||||
this.$utools.putDB(
|
||||
_.cloneDeep(this.quickcommandInfo),
|
||||
this.$utools.DBPRE.QC + this.quickcommandInfo.features.code
|
||||
);
|
||||
this.$emit("editorEvent", {
|
||||
type: "save",
|
||||
data: _.cloneDeep(this.quickcommandInfo),
|
||||
});
|
||||
this.closeEditor();
|
||||
this.$nextTick(() => {
|
||||
document
|
||||
.getElementById(this.quickcommandInfo.features.code)
|
||||
.querySelector(".q-toggle[aria-checked='false']")
|
||||
?.click();
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
|
@@ -256,7 +256,12 @@ export default {
|
||||
outputTypes: outputTypes,
|
||||
outputTypesOptions: Object.keys(outputTypes),
|
||||
specialVar: "{{}}",
|
||||
allQuickCommandTags: this.$parent.parent.allQuickCommandTags,
|
||||
allQuickCommandTags: _.without(
|
||||
this.$parent.parent.allQuickCommandTags,
|
||||
"默认",
|
||||
"未分类",
|
||||
"搜索结果"
|
||||
),
|
||||
};
|
||||
},
|
||||
props: {
|
||||
@@ -282,7 +287,7 @@ export default {
|
||||
this.currentCommand,
|
||||
_.pick(this.quickcommandInfo, "tags", "output", "features")
|
||||
);
|
||||
this.setIcon(this.currentCommand.program);
|
||||
this.setIcon(this.quickcommandInfo.program);
|
||||
this.platformVerify();
|
||||
},
|
||||
// 没有图标,或者使用了语言图标
|
||||
|
Reference in New Issue
Block a user