From 7bd51ce1e65e33466ae6939bb3fe99f466ea8181 Mon Sep 17 00:00:00 2001 From: quenousimporte Date: Tue, 7 Nov 2023 09:13:45 +0100 Subject: [PATCH] changed: use tag emoji in note lists --- main.js | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/main.js b/main.js index 1ca2d73..b0e4a68 100644 --- a/main.js +++ b/main.js @@ -18,7 +18,7 @@ var defaultsettings = bulletrendering: "•", password: "", sync: false, - tagsinpalette: true + tagsinlists: true }; //builtin @@ -1653,12 +1653,12 @@ function commandpalette() .concat(localdata.map(n => { var entry = "Open note: " + n.title; - if (settings.tagsinpalette) + if (settings.tagsinlists) { var tags = gettags(n); if (tags.length) { - entry += " - tags: " + tags.join(); + entry += " 🏷" + tags.join(" 🏷"); } } return entry; @@ -1681,7 +1681,7 @@ function commandpalette() } else if (hint.startsWith("Open note: ")) { - loadnote(hint.replace("Open note: ", "").replace(/ - tags:.*/, "")); + loadnote(hint.replace("Open note: ", "").replace(/ 🏷.*/, "")); } else if (hint.startsWith("Edit setting: ")) { @@ -2249,17 +2249,38 @@ function toggletitle() function selectnote() { - return searchinlist(list()); + return searchinlist( + list() + .map(title => + { + if (settings.tagsinlists) + { + var tags = gettags(getnote(title)); + if (tags.length) + { + return title += " 🏷" + tags.join(" 🏷"); + } + } + return title; + })); } function searchautocomplete() { - selectnote().then(insertautocomplete); + selectnote().then(selected => + { + selected = selected.replace(/ 🏷.*/, ""); + insertautocomplete(selected); + }); } function searchandloadnote() { - selectnote().then(loadnote); + selectnote().then(selected => + { + selected = selected.replace(/ 🏷.*/, ""); + loadnote(selected); + }); } function currentistodo() @@ -2557,7 +2578,7 @@ function mainkeydownhandler() function setwindowtitle() { - document.title = (currenttag ? currenttag + "\\": "") + currentnote.title; + document.title = (currenttag ? "🏷" + currenttag + " | " : "") + currentnote.title; } function ontitlechange()