mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-08-10 23:10:59 +08:00
快捷键调整
This commit is contained in:
parent
70321d7df3
commit
bb247ee8c8
@ -221,6 +221,7 @@
|
|||||||
:placeholder="true"
|
:placeholder="true"
|
||||||
ref="editor"
|
ref="editor"
|
||||||
@typing="(val) => (quickcommandInfo.cmd = val)"
|
@typing="(val) => (quickcommandInfo.cmd = val)"
|
||||||
|
@keyStroke="monacoKeyStroke"
|
||||||
:style="{
|
:style="{
|
||||||
top: languageBarHeight + 'px',
|
top: languageBarHeight + 'px',
|
||||||
left: this.action.type === 'run' ? 0 : this.sideBarWidth + 'px',
|
left: this.action.type === 'run' ? 0 : this.sideBarWidth + 'px',
|
||||||
@ -272,6 +273,7 @@ export default {
|
|||||||
resultMaxLength: 10000,
|
resultMaxLength: 10000,
|
||||||
showSidebar: this.action.type !== "run",
|
showSidebar: this.action.type !== "run",
|
||||||
isRunCodePage: this.action.type === "run",
|
isRunCodePage: this.action.type === "run",
|
||||||
|
listener: null,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
@ -279,17 +281,9 @@ export default {
|
|||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.init();
|
this.init();
|
||||||
this.$refs.sidebar?.init();
|
|
||||||
},
|
},
|
||||||
beforeUnmount() {
|
beforeUnmount() {
|
||||||
!!this.recording && document.removeEventListener("keyup", this.recording);
|
this.saveCodeHistory();
|
||||||
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: {
|
computed: {
|
||||||
configurationPage() {
|
configurationPage() {
|
||||||
@ -320,6 +314,7 @@ export default {
|
|||||||
if (this.quickcommandInfo.tags?.includes("默认") && !utools.isDev()) {
|
if (this.quickcommandInfo.tags?.includes("默认") && !utools.isDev()) {
|
||||||
this.canCommandSave = false;
|
this.canCommandSave = false;
|
||||||
}
|
}
|
||||||
|
this.$refs.sidebar?.init();
|
||||||
},
|
},
|
||||||
programChanged(value) {
|
programChanged(value) {
|
||||||
this.setLanguage(value);
|
this.setLanguage(value);
|
||||||
@ -383,6 +378,27 @@ export default {
|
|||||||
command.cmdType = this.$refs.sidebar?.cmdType.name;
|
command.cmdType = this.$refs.sidebar?.cmdType.name;
|
||||||
this.$refs.result.runCurrentCommand(command);
|
this.$refs.result.runCurrentCommand(command);
|
||||||
},
|
},
|
||||||
|
saveCodeHistory() {
|
||||||
|
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"
|
||||||
|
);
|
||||||
|
},
|
||||||
|
monacoKeyStroke(event) {
|
||||||
|
switch (event) {
|
||||||
|
case "run":
|
||||||
|
this.runCurrentCommand();
|
||||||
|
break;
|
||||||
|
case "save":
|
||||||
|
this.saveCurrentCommand();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -217,7 +217,7 @@ export default {
|
|||||||
this.rawEditor.addCommand(
|
this.rawEditor.addCommand(
|
||||||
monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyB,
|
monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyB,
|
||||||
() => {
|
() => {
|
||||||
that.$parent.runCurrentCommand();
|
that.$emit("keyStroke", "run");
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
// alt + z 换行
|
// alt + z 换行
|
||||||
@ -229,7 +229,7 @@ export default {
|
|||||||
this.rawEditor.addCommand(
|
this.rawEditor.addCommand(
|
||||||
monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyS,
|
monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyS,
|
||||||
() => {
|
() => {
|
||||||
that.$parent.saveCurrentCommand();
|
that.$emit("keyStroke", "save");
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user