mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-30 04:42:45 +08:00
自动导入默认命令
This commit is contained in:
parent
790c4a872c
commit
703f6b7097
@ -13,7 +13,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"program": "quickcommand",
|
"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",
|
"output": "text",
|
||||||
"hasSubInput": false,
|
"hasSubInput": false,
|
||||||
"scptarg": "",
|
"scptarg": "",
|
||||||
|
@ -299,6 +299,12 @@ export default {
|
|||||||
this.activatedQuickPanels = activatedFeatures.quickpanels;
|
this.activatedQuickPanels = activatedFeatures.quickpanels;
|
||||||
// 所有的快捷命令
|
// 所有的快捷命令
|
||||||
this.allQuickCommands = this.getAllQuickCommands();
|
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);
|
Object.assign(this.allQuickCommands, defaultCommands);
|
||||||
},
|
},
|
||||||
// 获取所有已启用的命令的 features 以及面板名称
|
// 获取所有已启用的命令的 features 以及面板名称
|
||||||
@ -468,7 +474,7 @@ export default {
|
|||||||
.getDocs(this.$utools.DBPRE.QC)
|
.getDocs(this.$utools.DBPRE.QC)
|
||||||
.map((x) => x._id)
|
.map((x) => x._id)
|
||||||
.forEach((y) => this.$utools.delDB(y));
|
.forEach((y) => this.$utools.delDB(y));
|
||||||
Object.assign(this.allQuickCommands, defaultCommands);
|
this.importDefaultCommands();
|
||||||
this.clearAllFeatures();
|
this.clearAllFeatures();
|
||||||
Object.keys(this.allQuickCommands).forEach((featureCode) => {
|
Object.keys(this.allQuickCommands).forEach((featureCode) => {
|
||||||
if (!featureCode.includes("default_"))
|
if (!featureCode.includes("default_"))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user