mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-08 14:34:13 +08:00
完善保存命令功能
This commit is contained in:
parent
827e19b559
commit
9694570dea
@ -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();
|
||||
},
|
||||
// 没有图标,或者使用了语言图标
|
||||
|
@ -96,6 +96,7 @@ const commandTypes = {
|
||||
icon: "construction",
|
||||
desc: "通过json格式的配置实现同时匹配关键字、窗口、文件甚至图片,或者指定文件数量、窗口类等",
|
||||
valueType: "json",
|
||||
disabledSpecialVars: null,
|
||||
matchToCmds: (rules, desc) => JSON.parse(rules),
|
||||
verify: rules => {
|
||||
try {
|
||||
|
@ -422,12 +422,12 @@ export default {
|
||||
let el = document.getElementById(code);
|
||||
el.scrollIntoViewIfNeeded();
|
||||
// 闪一下
|
||||
el.style.filter = "invert(1) drop-shadow(1px 1px 5px #0000008e)";
|
||||
el.style.filter = "drop-shadow(2px 4px 6px black)";
|
||||
el.style.transform = "translateY(-5px)";
|
||||
setTimeout(() => {
|
||||
el.style.filter = "";
|
||||
el.style.transform = "";
|
||||
}, 500);
|
||||
}, 800);
|
||||
});
|
||||
},
|
||||
// 全部导出
|
||||
@ -513,6 +513,9 @@ export default {
|
||||
case "close":
|
||||
this.isCommandEditorShow = false;
|
||||
return;
|
||||
case "save":
|
||||
this.allQuickCommands[event.data.features.code] = event.data;
|
||||
this.locateToCommand(event.data.tags, event.data.features.code);
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user