diff --git a/main.js b/main.js index 519cd45..2da72b8 100644 --- a/main.js +++ b/main.js @@ -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;