mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-09-24 13:03:30 +08:00
数据存储结构调整
This commit is contained in:
@@ -145,10 +145,7 @@
|
||||
}"
|
||||
/>
|
||||
<!-- 运行结果 -->
|
||||
<CommandRunResult
|
||||
:action="runResultAction"
|
||||
ref="result"
|
||||
></CommandRunResult>
|
||||
<CommandRunResult :action="runResultAction" ref="result"></CommandRunResult>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -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);
|
||||
},
|
||||
|
@@ -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();
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user