Disable save hotkey when it is not appropriate

This commit is contained in:
Magnus Hovland Hoff 2018-09-16 22:31:57 +02:00
parent 534dffdfe3
commit ecf4c1e98e

View file

@ -187,8 +187,8 @@ function openEditor() {
document.addEventListener("keypress", function (ev) { document.addEventListener("keypress", function (ev) {
const accel = ev.ctrlKey || ev.metaKey; // Imprecise, but works cross platform const accel = ev.ctrlKey || ev.metaKey; // Imprecise, but works cross platform
if (ev.key === "Enter" && accel) { if (ev.key === "Enter" && accel) {
//TODO Disable when in the process of saving const isEditing = container.classList.contains('edit');
//TODO Disable when not editing if (!isEditing) return;
ev.stopPropagation(); ev.stopPropagation();
ev.preventDefault(); ev.preventDefault();