mirror of
https://github.com/boxgaming/qbjs.git
synced 2024-09-19 20:14:58 +00:00
added support for F5 (build) and F11 (share) when in IDE mode
This commit is contained in:
parent
5f7106c513
commit
e706907e79
1 changed files with 18 additions and 0 deletions
18
qbjs-ide.js
18
qbjs-ide.js
|
@ -45,6 +45,7 @@ async function init() {
|
||||||
document.getElementById("gx-load-screen").style.display = "block";
|
document.getElementById("gx-load-screen").style.display = "block";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// initialize the code editor
|
// initialize the code editor
|
||||||
editor = CodeMirror(document.querySelector("#code"), {
|
editor = CodeMirror(document.querySelector("#code"), {
|
||||||
lineNumbers: true,
|
lineNumbers: true,
|
||||||
|
@ -70,6 +71,23 @@ async function init() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// if IDE mode, capture the F5 event
|
||||||
|
if (appMode != "play" && appMode != "auto") {
|
||||||
|
window.addEventListener("keydown", function(event) {
|
||||||
|
// run
|
||||||
|
if (event.code == 'F5') {
|
||||||
|
event.preventDefault();
|
||||||
|
runProgram();
|
||||||
|
}
|
||||||
|
// compile
|
||||||
|
else if (event.code == 'F11') {
|
||||||
|
event.preventDefault();
|
||||||
|
shareProgram();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
document.getElementsByClassName("CodeMirror-cursor")[0].innerHTML = " ";
|
document.getElementsByClassName("CodeMirror-cursor")[0].innerHTML = " ";
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue