mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-29 20:32:44 +08:00
自动导入默认命令
This commit is contained in:
parent
790c4a872c
commit
703f6b7097
@ -13,7 +13,7 @@
|
||||
]
|
||||
},
|
||||
"program": "quickcommand",
|
||||
"cmd": "var snippet = {}\nquickcommand.showTextArea(\"请输入代码片段\").then(code => {\n snippet.body = code.split(\"\\n\")\n quickcommand.showInputBox([\"代码片段的描述\", \"触发代码片段的关键词\"])\n .then(inputs => {\n snippet.prefix = inputs[1]\n snippet.description = inputs[0]\n var result = `\"${inputs[0]}\": ` + JSON.stringify(snippet, null, '\\t')\n console.log(result)\n utools.copyText(result)\n quickcommand.showMessageBox('已复制')\n })\n})",
|
||||
"cmd": "var snippet = {}\nquickcommand.showTextArea(\"请输入代码片段\").then(code => {\n snippet.body = code.split(\"\\n\")\n quickcommand.showInputBox([\"代码片段的描述\", \"触发代码片段的关键词\"])\n .then(inputs => {\n snippet.prefix = inputs[1]\n snippet.description = inputs[0]\n var result = `\"${inputs[0]}\": ` + JSON.stringify(snippet, null, '\\t')\n console.log(result+'\\n结果已复制')\n utools.copyText(result)})\n})",
|
||||
"output": "text",
|
||||
"hasSubInput": false,
|
||||
"scptarg": "",
|
||||
|
@ -299,6 +299,12 @@ export default {
|
||||
this.activatedQuickPanels = activatedFeatures.quickpanels;
|
||||
// 所有的快捷命令
|
||||
this.allQuickCommands = this.getAllQuickCommands();
|
||||
this.importDefaultCommands();
|
||||
},
|
||||
importDefaultCommands() {
|
||||
for (var code of Object.keys(defaultCommands)) {
|
||||
this.$utools.putDB(defaultCommands[code], this.$utools.DBPRE.QC + code);
|
||||
}
|
||||
Object.assign(this.allQuickCommands, defaultCommands);
|
||||
},
|
||||
// 获取所有已启用的命令的 features 以及面板名称
|
||||
@ -468,7 +474,7 @@ export default {
|
||||
.getDocs(this.$utools.DBPRE.QC)
|
||||
.map((x) => x._id)
|
||||
.forEach((y) => this.$utools.delDB(y));
|
||||
Object.assign(this.allQuickCommands, defaultCommands);
|
||||
this.importDefaultCommands();
|
||||
this.clearAllFeatures();
|
||||
Object.keys(this.allQuickCommands).forEach((featureCode) => {
|
||||
if (!featureCode.includes("default_"))
|
||||
|
Loading…
x
Reference in New Issue
Block a user