mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-10-24 12:31:23 +08:00
退出时保存光标位置
This commit is contained in:
20
src/App.vue
20
src/App.vue
@@ -21,6 +21,7 @@ export default defineComponent({
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
window.root = this;
|
||||
window.utools = window.getuToolsLite();
|
||||
// 版本检测
|
||||
const requiredVersion = "2.6.1";
|
||||
@@ -44,17 +45,26 @@ export default defineComponent({
|
||||
});
|
||||
// 退出插件
|
||||
utools.onPluginOut(() => {
|
||||
// 保存偏好
|
||||
this.saveProfile();
|
||||
// 切到空路由
|
||||
this.$router.push("loading");
|
||||
// 清空临时数据
|
||||
window.temporaryStoreSoldOut();
|
||||
// 保存偏好
|
||||
this.$utools.putDB(
|
||||
_.cloneDeep(this.$profile),
|
||||
this.$utools.DBPRE.CFG + "preferences"
|
||||
);
|
||||
});
|
||||
},
|
||||
saveProfile() {
|
||||
let commandEditor = this.$refs.view.$refs.commandEditor;
|
||||
if (commandEditor && commandEditor.action.type !== "edit") {
|
||||
let command = _.cloneDeep(commandEditor.quickcommandInfo);
|
||||
command.cursorPosition = commandEditor.$refs.editor.getCursorPosition();
|
||||
this.$profile.codeHistory[commandEditor.action.type] = command;
|
||||
}
|
||||
this.$utools.putDB(
|
||||
_.cloneDeep(this.$profile),
|
||||
this.$utools.DBPRE.CFG + "preferences"
|
||||
);
|
||||
},
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user