From b1c687e9a52d73dbf49433e932e4c31a8cd3ab08 Mon Sep 17 00:00:00 2001 From: quenousimporte Date: Thu, 14 Sep 2023 11:54:09 +0200 Subject: [PATCH] added: default headers --- main.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/main.js b/main.js index 1260ad7..fb1acec 100644 --- a/main.js +++ b/main.js @@ -1347,7 +1347,7 @@ function getorcreate(title, content, putontop) var note = getnote(title); if (!note) { - note = {title: title, content: content}; + note = {title: title, content: content, pos: content.length}; localdata.push(note) } @@ -2487,9 +2487,20 @@ function bindfile(note) setpos(note.pos || 0); } +function defaultheaders(title) +{ + return [ + "---", + "title: " + title, + "date: " + timestamp().substr(0,10), + "tags: ", + "---", + "",""].join("\n"); +} + function loadnote(name) { - var note = getorcreate(name, "", true); + var note = getorcreate(name, defaultheaders(name), true); bindfile(note); stat.cur.q = 0;