mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-07 13:34:08 +08:00
新增创建命令副本
This commit is contained in:
parent
a6c4016831
commit
f606c34eca
@ -59,6 +59,13 @@
|
||||
<q-item-section>复制到剪贴板</q-item-section>
|
||||
</q-item>
|
||||
|
||||
<q-item clickable v-close-popup @click="createCommandCopy">
|
||||
<q-item-section side>
|
||||
<q-icon name="file_copy" />
|
||||
</q-item-section>
|
||||
<q-item-section>创建命令副本</q-item-section>
|
||||
</q-item>
|
||||
|
||||
<q-item clickable @click="shareCommand" v-close-popup>
|
||||
<q-item-section side>
|
||||
<q-icon name="share" />
|
||||
@ -189,6 +196,13 @@ export default {
|
||||
`「${this.commandInfo.features.explain}」已复制到剪贴板`
|
||||
);
|
||||
},
|
||||
// 创建命令副本
|
||||
createCommandCopy() {
|
||||
this.$emit("commandChanged", {
|
||||
type: "createCopy",
|
||||
data: this.featureCode,
|
||||
});
|
||||
},
|
||||
// 导出到文件
|
||||
exportCommandFile() {
|
||||
window.saveFile(JSON.stringify(this.getRawCommand()), {
|
||||
|
@ -210,6 +210,13 @@ export function useCommandManager() {
|
||||
return parsedData.qc;
|
||||
};
|
||||
|
||||
// 创建命令副本
|
||||
const createCommandCopy = (code) => {
|
||||
const command = window.lodashM.cloneDeep(state.allQuickCommands[code]);
|
||||
command.features.code = getFeatureCode(command.features.cmds);
|
||||
saveCommand(command);
|
||||
};
|
||||
|
||||
// 是否为默认命令
|
||||
const isDefaultCommand = (code) => {
|
||||
return code.slice(0, 8) === "default_";
|
||||
@ -349,6 +356,7 @@ export function useCommandManager() {
|
||||
enableCommand,
|
||||
disableCommand,
|
||||
importCommand,
|
||||
createCommandCopy,
|
||||
isDefaultCommand,
|
||||
exportAllCommands,
|
||||
getActivatedFeatures,
|
||||
|
@ -132,6 +132,9 @@ export default {
|
||||
case "run":
|
||||
this.runCommand(event.data);
|
||||
return;
|
||||
case "createCopy":
|
||||
this.createCommandCopy(event.data);
|
||||
return;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
@ -157,6 +160,10 @@ export default {
|
||||
this.changeCurrentTag("默认");
|
||||
}
|
||||
},
|
||||
// 创建命令副本
|
||||
createCommandCopy(code) {
|
||||
this.commandManager.createCommandCopy(code);
|
||||
},
|
||||
// 编辑命令
|
||||
editCommand(commandOrCode) {
|
||||
// 即可传入 code,也可直接传入 command
|
||||
|
Loading…
x
Reference in New Issue
Block a user