added: insert header common
This commit is contained in:
parent
4621a0aa0b
commit
f01fb199dc
17
main.js
17
main.js
|
@ -207,6 +207,12 @@ var commands = [
|
||||||
hint: "Restore note",
|
hint: "Restore note",
|
||||||
action: restore
|
action: restore
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
shortcut: "ctrl+h",
|
||||||
|
hint: "Insert markdown header",
|
||||||
|
action: insertheader,
|
||||||
|
allowunsaved: true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
shortcut: "F1",
|
shortcut: "F1",
|
||||||
hint: "Show help",
|
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)
|
function splitshortcut(s)
|
||||||
{
|
{
|
||||||
var r = {};
|
var r = {};
|
||||||
|
|
Loading…
Reference in New Issue