refectored: esc key to prepare back button

This commit is contained in:
quenousimporte 2023-07-04 10:22:57 +02:00
parent 1987e2a0a4
commit d84ec16c5d
1 changed files with 25 additions and 20 deletions

45
main.js
View File

@ -2086,30 +2086,35 @@ function executecommand(command)
}
}
function esc(event)
{
if (!searchdialog.hidden)
{
event.preventDefault();
searchdialog.hidden = true;
filter.placeholder = "Search...";
md.focus();
}
else if (currentnote.title == "Help" || currentnote.title == "Search result")
{
loadlast();
}
else if (networkpage.hidden == false)
{
networkpage.hidden = true;
md.hidden = false;
}
else if (preview.hidden == false)
{
togglepreview();
}
}
function mainkeydownhandler()
{
if (event.key == "Escape")
{
if (!searchdialog.hidden)
{
event.preventDefault();
searchdialog.hidden = true;
filter.placeholder = "Search...";
md.focus();
}
else if (currentnote.title == "Help" || currentnote.title == "Search result")
{
loadlast();
}
else if (networkpage.hidden == false)
{
networkpage.hidden = true;
md.hidden = false;
}
else if (preview.hidden == false)
{
togglepreview();
}
esc(event);
}
else if (!searchdialog.hidden && (event.key == "Tab" || event.keyCode == "40" || event.keyCode == "38"))
{