added: command to remove completed tasks in todotxt

This commit is contained in:
quenousimporte 2023-12-12 17:40:42 +01:00
parent 883d5de0bc
commit d6a04cbcb8
1 changed files with 13 additions and 0 deletions

13
main.js
View File

@ -274,6 +274,11 @@ var commands = [
{
hint: "Show backlinks",
action: backlinks
},
{
hint: "Remove completed tasks",
action: purgetodo,
allowunsaved: true
}];
var snippets = [
@ -319,6 +324,14 @@ var snippets = [
insert: "x " + (new Date).toISOString().substring(0, 10) + " "
}];
function purgetodo()
{
if (currentistodo() && confirm("Remove completed tasks?"))
{
seteditorcontent(currentnote.content.replace(/\nx .*/g, ""));
}
}
function seteditorcontent(content, silent)
{
md.value = content;