diff --git a/src/boot/global.js b/src/boot/global.js
index 05438c2..d934851 100644
--- a/src/boot/global.js
+++ b/src/boot/global.js
@@ -10,24 +10,19 @@ let defaultProfile = {
primaryColor: "#009688",
defaultPrimaryColor: "#009688",
backgroundImg: null,
+ codeHistory: {}
}
let userProfile = UTOOLS.getDB(
UTOOLS.DBPRE.CFG + "preferences"
);
Object.assign(defaultProfile, userProfile)
-utools.onPluginOut(() => {
- UTOOLS.putDB(
- defaultProfile,
- UTOOLS.DBPRE.CFG + "preferences"
- );
-});
// "async" is optional;
// more info on params: https://v2.quasar.dev/quasar-cli/boot-files
-export default boot(async ({
+export default boot(async({
app
}) => {
app.config.globalProperties.$utools = UTOOLS
app.config.globalProperties.$programmings = programmings
app.config.globalProperties.$profile = defaultProfile
-})
+})
\ No newline at end of file
diff --git a/src/components/CommandEditor.vue b/src/components/CommandEditor.vue
index d4b0314..0d04d6f 100644
--- a/src/components/CommandEditor.vue
+++ b/src/components/CommandEditor.vue
@@ -145,10 +145,7 @@
}"
/>
-
+
@@ -214,7 +211,8 @@ export default {
this.bindKeys();
let quickCommandInfo =
this.action.type === "run"
- ? this.$utools.getDB(this.$utools.DBPRE.CFG + "codeHistory")
+ ? this.$utools.getDB(this.$utools.DBPRE.CFG + "preferences")
+ ?.codeHistory
: this.action.data;
_.merge(this.quickcommandInfo, quickCommandInfo);
// monoca 相关
@@ -224,16 +222,8 @@ export default {
if (this.quickcommandInfo.tags?.includes("默认") && !utools.isDev()) {
this.canCommandSave = false;
}
- // 只有 runCode 时才保存记录
- if (this.action.type !== "run") return;
- utools.onPluginOut(() => {
- this.quickcommandInfo.cmd = this.$refs.editor.getEditorValue();
- // 保存本次编辑记录
- this.$utools.putDB(
- _.cloneDeep(this.quickcommandInfo),
- this.$utools.DBPRE.CFG + "codeHistory"
- );
- });
+ if (this.action.type === "run")
+ this.$profile.codeHistory = this.quickcommandInfo;
},
// 绑定快捷键
bindKeys() {
@@ -362,7 +352,6 @@ export default {
},
// 运行
runCurrentCommand() {
- this.quickcommandInfo.cmd = this.$refs.editor?.getEditorValue();
this.quickcommandInfo.output = this.$refs.menu?.currentCommand.output;
this.$refs.result.runCurrentCommand(this.quickcommandInfo);
},
diff --git a/src/components/MonocaEditor.vue b/src/components/MonocaEditor.vue
index a018385..1e8e014 100644
--- a/src/components/MonocaEditor.vue
+++ b/src/components/MonocaEditor.vue
@@ -34,11 +34,6 @@ export default {
return this.$q.dark.isActive;
},
},
- watch: {
- isDark() {
- this.setEditorTheme();
- },
- },
methods: {
initEditor() {
let monacoEditorPreferences = {
@@ -58,6 +53,7 @@ export default {
this.loadTypes();
this.registerLanguage();
this.setEditorTheme();
+ this.listenEditroValue();
},
loadTypes() {
monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
@@ -181,6 +177,11 @@ export default {
destoryEditor() {
this.rawEditor.dispose();
},
+ listenEditroValue() {
+ this.rawEditor.onDidChangeModelContent(() => {
+ this.$parent.quickcommandInfo.cmd = this.getEditorValue();
+ });
+ },
},
};
diff --git a/src/pages/CommandPage.vue b/src/pages/CommandPage.vue
index 248a256..b4b4333 100644
--- a/src/pages/CommandPage.vue
+++ b/src/pages/CommandPage.vue
@@ -15,6 +15,7 @@ export default {
type: "fromUtools",
data: {},
},
+ featureCode: this.$route.path.slice(1),
};
},
mounted() {
@@ -22,16 +23,10 @@ export default {
this.runCurrentCommand();
},
computed: {
- featureCode() {
- return this.$route.params.type + "_" + this.$route.params.uid;
- },
currentCommand() {
return this.$utools.whole.db.get("qc_" + this.featureCode).data;
},
},
- beforeRouteUpdate(to, from, next) {
- this.runCurrentCommand();
- },
methods: {
runCurrentCommand() {
this.$refs.result.runCurrentCommand(this.currentCommand);
diff --git a/src/pages/ConfigurationPage.vue b/src/pages/ConfigurationPage.vue
index 96aecfd..05b07f8 100644
--- a/src/pages/ConfigurationPage.vue
+++ b/src/pages/ConfigurationPage.vue
@@ -191,17 +191,25 @@