From ecf4c1e98ec01711cbf11d0d78508396d1fe7766 Mon Sep 17 00:00:00 2001 From: Magnus Hovland Hoff Date: Sun, 16 Sep 2018 22:31:57 +0200 Subject: [PATCH] Disable save hotkey when it is not appropriate --- assets/script.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/script.js b/assets/script.js index 482ca29..9bc7e88 100644 --- a/assets/script.js +++ b/assets/script.js @@ -187,8 +187,8 @@ function openEditor() { document.addEventListener("keypress", function (ev) { const accel = ev.ctrlKey || ev.metaKey; // Imprecise, but works cross platform if (ev.key === "Enter" && accel) { - //TODO Disable when in the process of saving - //TODO Disable when not editing + const isEditing = container.classList.contains('edit'); + if (!isEditing) return; ev.stopPropagation(); ev.preventDefault();