constantinSch commited on
Commit
b0c32db
·
1 Parent(s): 5f0256c

Add keyboard shortcut for saving annotations with Ctrl+S

Browse files
Files changed (1) hide show
  1. index.html +5 -0
index.html CHANGED
@@ -664,6 +664,11 @@ function showToast(msg, type) {
664
  }
665
 
666
  document.addEventListener("keydown", e => {
 
 
 
 
 
667
  if (e.target.tagName === "SELECT" || e.target.tagName === "TEXTAREA") return;
668
  if (e.key === "ArrowLeft") navigate(-1);
669
  if (e.key === "ArrowRight") navigate(1);
 
664
  }
665
 
666
  document.addEventListener("keydown", e => {
667
+ if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "s") {
668
+ e.preventDefault();
669
+ if (!document.getElementById("btn-save").disabled) saveAnnotation();
670
+ return;
671
+ }
672
  if (e.target.tagName === "SELECT" || e.target.tagName === "TEXTAREA") return;
673
  if (e.key === "ArrowLeft") navigate(-1);
674
  if (e.key === "ArrowRight") navigate(1);