From 88444f40fc2bb75bd1fcab85201b3cee41ca4fb2 Mon Sep 17 00:00:00 2001 From: quenousimporte <76260127+quenousimporte@users.noreply.github.com> Date: Wed, 25 Jan 2023 23:50:48 +0100 Subject: [PATCH] added: force save on ctrl+s --- main.js | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/main.js b/main.js index 2762456..875328a 100644 --- a/main.js +++ b/main.js @@ -274,8 +274,12 @@ var commands = [ hint: "Show note info", action: showinfo, shortcut: "ctrl+w" -} -]; +}, +{ + hint: "Force save", + action: save, + shortcut: "ctrl+s" +}]; var snippets = [ { @@ -1368,14 +1372,10 @@ function waitpending() }); } -function datachanged() +function save() { - resize(); - - saved = false; - - postpone() - .then(waitpending) + clearTimeout(workerid); + waitpending() .then(() => { var content = getnotecontent(); @@ -1428,6 +1428,16 @@ function datachanged() }); } +function datachanged() +{ + resize(); + + saved = false; + + postpone() + .then(save); +} + function loadtodo() { loadnote("todo"); @@ -1586,12 +1596,7 @@ function splitshortcut(s) function mainkeydownhandler() { - if (event.key == "s" && event.ctrlKey) - { - event.preventDefault(); - console.log("ctrl+s is useless!"); - } - else if (event.key == "Escape") + if (event.key == "Escape") { if (!searchdialog.hidden) {