删除命令时也清空对应历史记录

This commit is contained in:
fofolee 2024-12-20 16:19:30 +08:00
parent 1cb2dee7df
commit 5e654a8964

View File

@ -442,6 +442,7 @@ export default {
utools.copyText(JSON.stringify(this.allQuickCommands[code], null, 4));
delete this.allQuickCommands[code];
this.$root.utools.delDB("qc_" + code);
this.removeCommandFromHistory(code);
this.disableCommand(code);
this.getAllQuickCommandTags();
if (!this.allQuickCommandTags.includes(this.currentTag))
@ -449,9 +450,18 @@ export default {
quickcommand.showMessageBox(
"删除成功,为防止误操作,已将删除的命令复制到剪贴板",
"success",
1000
1000,
"bottom-right"
);
},
removeCommandFromHistory(code) {
for (let i = 0; i < localStorage.length; i++) {
const key = localStorage.key(i);
if (key.startsWith("editor_history_" + code)) {
localStorage.removeItem(key);
}
}
},
//
editCommand(command) {
// code command