1
1
Fork 0
mirror of https://github.com/boxgaming/qbjs.git synced 2024-09-20 04:24:45 +00:00

added support for F5 (build) and F11 (share) when in IDE mode

This commit is contained in:
boxgaming 2023-03-21 12:05:37 -05:00
parent 5f7106c513
commit e706907e79

View file

@ -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 = " ";