change tag mark

This commit is contained in:
quenousimporte 2023-11-09 22:46:16 +01:00
parent e570640970
commit 3865bccc30
1 changed files with 8 additions and 7 deletions

15
main.js
View File

@ -25,6 +25,7 @@ var defaultsettings =
//builtin //builtin
var markerslist = ["* ", "- ", " * ", " - ", ">> ", "> ", "=> ", "— ", "[ ] ", " ", "• ", "- [ ]"]; var markerslist = ["* ", "- ", " * ", " - ", ">> ", "> ", "=> ", "— ", "[ ] ", " ", "• ", "- [ ]"];
var codelanguages = ["xml", "js", "sql"]; var codelanguages = ["xml", "js", "sql"];
var tagmark = "+";
// globals // globals
var currentnote = null; var currentnote = null;
@ -520,7 +521,7 @@ function savesettings()
function removetaghint() function removetaghint()
{ {
return "Remove tag filter 🏷" + settings.tagfilter; return "Remove tag filter " + tagmark + settings.tagfilter;
} }
function addtagfilter() function addtagfilter()
@ -1648,7 +1649,7 @@ function titlewithtags(note)
var tags = gettags(note); var tags = gettags(note);
if (tags.length) if (tags.length)
{ {
text += " 🏷" + tags.join(" 🏷"); text += " " + tagmark + tags.join(" " + tagmark);
} }
} }
return text; return text;
@ -1679,7 +1680,7 @@ function commandpalette()
} }
else if (hint.startsWith("Open note: ")) else if (hint.startsWith("Open note: "))
{ {
loadnote(hint.replace("Open note: ", "").replace(/ 🏷.*/, "")); loadnote(hint.replace("Open note: ", "").replace(new RegExp(" " + tagmark + ".*"), ""));
} }
else if (hint.startsWith("Edit setting: ")) else if (hint.startsWith("Edit setting: "))
{ {
@ -2251,14 +2252,14 @@ function selectnote()
return searchinlist( return searchinlist(
localdata localdata
.map(n => titlewithtags(n)) .map(n => titlewithtags(n))
.filter(text => !settings.tagfilter || text.includes("🏷" + settings.tagfilter))); .filter(text => !settings.tagfilter || text.includes(tagmark + settings.tagfilter)));
} }
function searchautocomplete() function searchautocomplete()
{ {
selectnote().then(selected => selectnote().then(selected =>
{ {
selected = selected.replace(/ 🏷.*/, ""); selected = selected.replace(new RegExp(" " + tagmark + ".*"), "");
insertautocomplete(selected); insertautocomplete(selected);
}); });
} }
@ -2267,7 +2268,7 @@ function searchandloadnote()
{ {
selectnote().then(selected => selectnote().then(selected =>
{ {
selected = selected.replace(/ 🏷.*/, ""); selected = selected.replace(new RegExp(" " + tagmark + ".*"), "");
loadnote(selected); loadnote(selected);
}); });
} }
@ -2567,7 +2568,7 @@ function mainkeydownhandler()
function setwindowtitle() function setwindowtitle()
{ {
document.title = (settings.tagfilter ? "🏷" + settings.tagfilter + " | " : "") + currentnote.title; document.title = (settings.tagfilter ? settings.tagfilter + " | " : "") + currentnote.title;
} }
function ontitlechange() function ontitlechange()