added: insert header common

This commit is contained in:
quenousimporte 2023-07-20 09:52:17 +02:00
parent 4621a0aa0b
commit f01fb199dc
1 changed files with 17 additions and 0 deletions

17
main.js
View File

@ -207,6 +207,12 @@ var commands = [
hint: "Restore note",
action: restore
},
{
shortcut: "ctrl+h",
hint: "Insert markdown header",
action: insertheader,
allowunsaved: true
},
{
shortcut: "F1",
hint: "Show help",
@ -2096,6 +2102,17 @@ function restore()
}
}
function insertheader()
{
if (preview.hidden && !md.value.startsWith("---\n"))
{
var headers = "---\ndate: " + (new Date).toISOString().substring(0, 10) + "\ntags: \n---\n\n";
md.value = headers + md.value;
setpos(27);
}
resize();
}
function splitshortcut(s)
{
var r = {};