save with ctrl-s

This commit is contained in:
foamyguy 2022-07-25 19:30:44 -05:00
parent d0782b60cb
commit 0ef6871a93

View File

@ -30,4 +30,18 @@ function save() {
document.querySelector("#save_btn").onclick = function () {
console.log("Click Save!");
save();
}
let isCtrl = false;
document.onkeyup=function(e){
if(e.keyCode === 17) isCtrl=false;
}
document.onkeydown=function(e){
if(e.keyCode === 17) isCtrl=true;
if(e.keyCode === 83 && isCtrl === true) {
//ctrl-s pressed
save();
return false;
}
}