运行命令快捷键

This commit is contained in:
fofolee 2022-03-30 18:31:56 +08:00
parent ac184cdad1
commit 1c7c3c95b8

View File

@ -114,7 +114,7 @@
</q-toolbar> </q-toolbar>
<q-card-section class="row items-center"> <q-card-section class="row items-center">
<pre <pre
:class="runResultStatus ? 'text-green' : 'text-red'" :class="runResultStatus ? '' : 'text-red'"
v-html="runResult" v-html="runResult"
></pre> ></pre>
</q-card-section> </q-card-section>
@ -160,6 +160,7 @@ export default {
}, },
methods: { methods: {
initEditor() { initEditor() {
let that = this;
this.editor = monaco.editor.create( this.editor = monaco.editor.create(
document.getElementById("monocaEditor"), document.getElementById("monocaEditor"),
{ {
@ -174,6 +175,12 @@ export default {
}, },
} }
); );
this.editor.addCommand(
monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyB,
function () {
that.runCurrentCommand();
}
);
}, },
getEditorValue() { getEditorValue() {
return toRaw(this.editor).getValue(); return toRaw(this.editor).getValue();