diff --git a/editor/src/fuse.js b/editor/src/fuse.js index effd939..f76401b 100644 --- a/editor/src/fuse.js +++ b/editor/src/fuse.js @@ -14,6 +14,7 @@ function createTitleSearch() { {title: 'Tomorrow', name: 'tomorrow'}, {title: 'Yesterday', name: 'yesterday'}, {title: 'TODO', name: 'todo'}, + {title: 'DONE', name: 'done'}, {title: 'Page Reference', name: 'page_reference'}, {title: 'Code Block', name: 'code_block'}, ]; diff --git a/editor/src/index.js b/editor/src/index.js index a0bd87b..2dc6ecf 100644 --- a/editor/src/index.js +++ b/editor/src/index.js @@ -165,6 +165,7 @@ if (holder) { } else if (resultType === 'command') { let start = value.lastIndexOf("/", end) let commandResult = "" + let replace = "" let prefix = false let adjustment = 0 @@ -180,6 +181,11 @@ if (holder) { commandResult = "[[" + now.add(-1, 'day').format('D MMMM YYYY') + "]]" } else if (linkName === "TODO") { commandResult = "#[[TODO]] " + replace = "#[[DONE]] " + prefix = true + } else if (linkName === "DONE") { + commandResult = "#[[DONE]] " + replace = "#[[TODO]] " prefix = true } else if (linkName === "Page Reference") { commandResult = "[[]]" @@ -190,7 +196,7 @@ if (holder) { } let startAndLink = prefix - ? commandResult + value.substring(0, start) + ? commandResult + value.substring(0, start).replace(replace, "") : value.substring(0, start) + commandResult input.value = startAndLink + value.substring(end)