diff --git a/main.js b/main.js
index 84002fe..aacf21c 100644
--- a/main.js
+++ b/main.js
@@ -14,8 +14,7 @@ var defaultsettings =
password: "",
sync: false,
tagsinlists: true,
- uselinkpopup: true,
- autosorttodo: true
+ uselinkpopup: true
};
//builtin
@@ -208,10 +207,6 @@ var commands = [
shortcut: "ctrl+h",
action: searchandreplace
},
-{
- hint: "Sort todo.txt list",
- action: sortcurrentastodo
-},
{
hint: "Sort text",
action: sortselection
@@ -219,10 +214,6 @@ var commands = [
{
hint: "Show backlinks",
action: backlinks
-},
-{
- hint: "Remove completed tasks",
- action: purgetodo
}];
var snippets = [
@@ -273,14 +264,6 @@ function genguid()
return crypto.randomUUID();
}
-function purgetodo()
-{
- if (currentistodo() && confirm("Remove completed tasks?"))
- {
- seteditorcontent(md.value.replace(/\nx .*/g, ""));
- }
-}
-
function seteditorcontent(content)
{
md.value = content;
@@ -2096,19 +2079,9 @@ function rawline2html(line, index, options)
}
}
- // todotxt
- if (currentistodo())
+ if (line.startsWith("x "))
{
- if (line.startsWith("x "))
- {
- line = "" + line + "";
- }
- else
- {
- line = line.replace(/(\(\w\))/g, "$1");
- line = line.replace(/(@\w*)/g, "$1");
- line = line.replace(/(\s\+\w*)/g, "$1");
- }
+ line = "" + line + "";
}
// inline code
@@ -2296,59 +2269,11 @@ function searchandloadnote()
});
}
-function currentistodo()
-{
- return istodo(title.value, md.value);
-}
-
function istodo(title, content)
{
return title.includes("todo") || gettags(content).includes("todo");
}
-function sorttodotxt(content)
-{
- var hat = headerandtext(content);
- var olditems = hat.text.split("\n");
- var prio = [];
- var std = [];
- var done = [];
- olditems.forEach(item =>
- {
- if (item)
- {
- if (item.startsWith("("))
- {
- item = item.substring(4);
- var priority = String.fromCharCode(65 + prio.length);
- prio.push(`(${priority}) ${item}`);
- }
- else if (item.startsWith("x "))
- {
- done.push(item);
- }
- else
- {
- std.push(item);
- }
- }
- });
-
- prio = prio.sort((a,b) => a.localeCompare(b));
- done = done.sort((a,b) => a.localeCompare(b));
- var all = prio.concat(std).concat(done);
- return hat.header + all.join("\n");
-}
-
-function sortcurrentastodo()
-{
- if (currentistodo())
- {
- var content = sorttodotxt(md.value);
- seteditorcontent(content);
- }
-}
-
function searchandreplace()
{
var oldvalue = prompt("Search:");
@@ -2874,11 +2799,6 @@ function loadnote(title)
}
}
- if (settings.autosorttodo && istodo(title, content))
- {
- content = sorttodotxt(content);
- }
-
bind(item.title, content, item.pos);
if (!preview.hidden || (preview.hidden && (gettags(md.value).indexOf("preview") !== -1)))