From 4b4fbf4916b55382d1e214a0bb61be73e1049b8f Mon Sep 17 00:00:00 2001 From: quenousimporte Date: Wed, 15 Nov 2023 22:00:39 +0100 Subject: [PATCH] drop tag filter --- main.js | 53 ++++------------------------------------------------- 1 file changed, 4 insertions(+), 49 deletions(-) diff --git a/main.js b/main.js index 73bf64a..73ca568 100644 --- a/main.js +++ b/main.js @@ -13,7 +13,6 @@ var defaultsettings = password: "", sync: false, tagsinlists: true, - tagfilter: "", uselinkpopup: true }; @@ -176,11 +175,6 @@ var commands = [ action: shownotelinks, shortcut: "ctrl+l" }, -{ - hint: "Add tag filter", - action: addtagfilter, - shortcut: "ctrl+shift+F", -}, { hint: "Show stats", action: showinfo, @@ -508,7 +502,6 @@ function showinfo() "word count: " + getwords(), "cursor position: " + md.selectionStart + " (" + pospercent() + "%)", (tags ? "tags: " + tags : ""), - "current filter: " + settings.tagfilter || "", "current note start: " + stat.cur.t, "current note queries: " + stat.cur.q, "current note data sent: " + formatsize(stat.cur.d), @@ -525,35 +518,6 @@ function savesettings() window.localStorage.setItem("settings", JSON.stringify(settings)); } -function removetaghint() -{ - return "Remove tag filter " + tagmark + settings.tagfilter; -} - -function addtagfilter() -{ - var command = commands.find(c => c.action == addtagfilter); - - if (!settings.tagfilter) - { - tagslist() - .then(t => - { - settings.tagfilter = t; - savesettings(); - command.hint = removetaghint(); - setwindowtitle(); - }); - } - else - { - settings.tagfilter = ""; - savesettings(); - command.hint = "Add tag filter"; - setwindowtitle(); - } -} - function descendants(note) { var list = [note]; @@ -1337,15 +1301,6 @@ function loadsettings() applystyle(); - if (settings.tagfilter) - { - var command = commands.find(c => c.hint == "Add tag filter"); - if (command) - { - command.hint = removetaghint(); - } - } - if (settings.titlebydefault && title.hidden) { toggletitle(); @@ -1776,7 +1731,7 @@ function commandpalette() .concat(localdata.map(n => { return { - prefix: "note ", + prefix: "open ", text: n.title, suffix: gettags(n).map(t => tagmark + t) }; @@ -1797,7 +1752,7 @@ function commandpalette() insert(snippet.insert, snippet.cursor); md.focus(); } - else if (selected.prefix == "note ") + else if (selected.prefix == "open ") { loadnote(selected.text); } @@ -2743,7 +2698,7 @@ function mainkeydownhandler() function setwindowtitle() { - document.title = (settings.tagfilter ? settings.tagfilter + " | " : "") + currentnote.title; + document.title = currentnote.title; } function ontitlechange() @@ -2988,7 +2943,7 @@ function defaultheaders(title, tags = "") return [ "---", "date: " + timestamp().substr(0,10), - "tags: " + (tags || settings.tagfilter || ""), + "tags: " + (tags || ""), "---", "",""].join("\n"); }