added: force save on ctrl+s

This commit is contained in:
quenousimporte 2023-01-25 23:50:48 +01:00
parent 0043b4978a
commit 88444f40fc
1 changed files with 20 additions and 15 deletions

35
main.js
View File

@ -274,8 +274,12 @@ var commands = [
hint: "Show note info", hint: "Show note info",
action: showinfo, action: showinfo,
shortcut: "ctrl+w" shortcut: "ctrl+w"
} },
]; {
hint: "Force save",
action: save,
shortcut: "ctrl+s"
}];
var snippets = [ var snippets = [
{ {
@ -1368,14 +1372,10 @@ function waitpending()
}); });
} }
function datachanged() function save()
{ {
resize(); clearTimeout(workerid);
waitpending()
saved = false;
postpone()
.then(waitpending)
.then(() => .then(() =>
{ {
var content = getnotecontent(); var content = getnotecontent();
@ -1428,6 +1428,16 @@ function datachanged()
}); });
} }
function datachanged()
{
resize();
saved = false;
postpone()
.then(save);
}
function loadtodo() function loadtodo()
{ {
loadnote("todo"); loadnote("todo");
@ -1586,12 +1596,7 @@ function splitshortcut(s)
function mainkeydownhandler() function mainkeydownhandler()
{ {
if (event.key == "s" && event.ctrlKey) if (event.key == "Escape")
{
event.preventDefault();
console.log("ctrl+s is useless!");
}
else if (event.key == "Escape")
{ {
if (!searchdialog.hidden) if (!searchdialog.hidden)
{ {