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",
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)
{