mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-08 06:16:27 +08:00
仅 runcode 才保存历史
This commit is contained in:
parent
3e6fa8364c
commit
6cfd054767
12
src/App.vue
12
src/App.vue
@ -86,21 +86,11 @@ export default defineComponent({
|
||||
this.$router.push(enter.code);
|
||||
},
|
||||
outPlugin() {
|
||||
this.saveProfile();
|
||||
this.$router.push("/");
|
||||
window.temporaryStoreSoldOut();
|
||||
},
|
||||
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"
|
||||
);
|
||||
this.$router.push("/");
|
||||
},
|
||||
runCronTask(featureCode, cronExp) {
|
||||
this.cronJobs[featureCode] = Cron(cronExp, () => {
|
||||
|
@ -199,6 +199,15 @@ export default {
|
||||
this.init();
|
||||
this.$refs.sidebar?.init();
|
||||
},
|
||||
beforeUnmount() {
|
||||
if (this.action.type !== "run") return;
|
||||
let command = _.cloneDeep(this.quickcommandInfo);
|
||||
command.cursorPosition = this.$refs.editor.getCursorPosition();
|
||||
this.$root.utools.putDB(
|
||||
command,
|
||||
this.$root.utools.DBPRE.CFG + "codeHistory"
|
||||
);
|
||||
},
|
||||
computed: {
|
||||
configurationPage() {
|
||||
return this.$root.$refs.view;
|
||||
@ -212,13 +221,11 @@ export default {
|
||||
);
|
||||
},
|
||||
},
|
||||
created() {},
|
||||
methods: {
|
||||
init() {
|
||||
let quickCommandInfo =
|
||||
this.action.type !== "edit"
|
||||
? this.$root.utools.getDB(this.$root.utools.DBPRE.CFG + "preferences")
|
||||
?.codeHistory[this.action.type]
|
||||
this.action.type === "run"
|
||||
? this.$root.utools.getDB(this.$root.utools.DBPRE.CFG + "codeHistory")
|
||||
: this.action.data;
|
||||
quickCommandInfo?.program &&
|
||||
Object.assign(this.quickcommandInfo, _.cloneDeep(quickCommandInfo));
|
||||
|
@ -3,7 +3,6 @@ export default {
|
||||
primaryColor: "#009688",
|
||||
defaultPrimaryColor: "#009688",
|
||||
backgroundImg: null,
|
||||
codeHistory: {},
|
||||
crontabs: {},
|
||||
quickFeatures: {
|
||||
favFile: {
|
||||
|
Loading…
x
Reference in New Issue
Block a user