feat: 清空命令后复制所有命令到剪贴板,防止误操作

This commit is contained in:
fofolee 2020-07-28 09:27:28 +08:00
parent 8c27effdf6
commit fc53baa581

View File

@ -338,7 +338,7 @@
}
// 全部导出
let exportAll = () => {
let exportAll = (copy = false) => {
let allQcs = getAllQuickCommands()
let options = {
title: '选择保存位置',
@ -350,17 +350,21 @@
if (!isDev()) Object.keys(allQcs).forEach(k => {
if (k.includes('default_')) delete allQcs[k]
})
window.saveFile(JSON.stringify(allQcs), options);
let stringifyQcs = JSON.stringify(allQcs)
if (copy) utools.copyText(stringifyQcs)
else window.saveFile(stringifyQcs, options);
}
// 清空
let clearAll = () => {
quickcommand.showConfirmBox('将会清空所有自定义命令,请确认!').then(x => {
if (!x) return
exportAll(true)
getDocs(QC_PREFIX).map(x => x._id).forEach(y => delDB(y))
importDefaultCommands();
clearAllFeatures();
showOptions();
quickcommand.showMessageBox('已将所有命令复制到剪贴板,如果是误操作可以点击导入命令恢复', 'warning')
})
}