added: setting to open links in new tab

changed: no section separation for enw events
changed: create new note if unkown command
fixed: show preview after note binding
This commit is contained in:
quenousimporte 2023-05-11 10:49:36 +02:00
parent 2f0d18822f
commit 49229b6f9d
1 changed files with 20 additions and 10 deletions

30
main.js
View File

@ -14,7 +14,8 @@ var defaultsettings =
titleinaccentcolor: false, titleinaccentcolor: false,
enablenetwork: false, enablenetwork: false,
titlebydefault: false, titlebydefault: false,
headerbydefault: false headerbydefault: false,
linksinnewtab: true
}; };
//builtin //builtin
@ -1267,12 +1268,12 @@ function checkevents()
showtemporaryinfo("New events to check"); showtemporaryinfo("New events to check");
var todo = getnote("todo"); var todo = getnote("todo");
var content = todo.content; var content = todo.content;
var newcontent = "---\n"; var newcontent = [];
newevents.forEach(evt => newevents.forEach(evt =>
{ {
newcontent += "new event: " + evt.DTSTART.toDateString() + " " + evt.SUMMARY + "\n"; newcontent.push("new event: " + evt.DTSTART.toDateString() + " " + evt.SUMMARY);
}); });
todo.content = newcontent + "---\n" + content; todo.content = newcontent.join("\n") + "\n" + content;
// reload todo if open // reload todo if open
if (currentnote == todo) if (currentnote == todo)
@ -1423,7 +1424,11 @@ function md2html(content)
converter.setOption("simplifiedAutoLink", true); converter.setOption("simplifiedAutoLink", true);
converter.setOption("simpleLineBreaks", true); converter.setOption("simpleLineBreaks", true);
converter.setOption("metadata", true); converter.setOption("metadata", true);
converter.setOption("openLinksInNewWindow", true);
if (settings.linksinnewtab)
{
converter.setOption("openLinksInNewWindow", true);
}
var html = converter.makeHtml(content); var html = converter.makeHtml(content);
@ -1558,6 +1563,11 @@ function commandpalette()
{ {
loadnote(hint.replace("Open note: ", "")); loadnote(hint.replace("Open note: ", ""));
} }
else
{
// if unknown command, create a new note
loadnote(hint);
}
} }
}); });
} }
@ -2289,17 +2299,17 @@ function loadnote(name)
localdata.unshift(note); localdata.unshift(note);
} }
if (!preview.hidden || (preview.hidden && gettags(note).indexOf("preview") !== -1))
{
togglepreview();
}
bindfile(note); bindfile(note);
putontop(); putontop();
stat.cur.q = 0; stat.cur.q = 0;
stat.cur.d = 0; stat.cur.d = 0;
stat.cur.t = timestamp(); stat.cur.t = timestamp();
if (!preview.hidden || (preview.hidden && gettags(note).indexOf("preview") !== -1))
{
togglepreview();
}
} }
function sendpassword() function sendpassword()