X-Git-Url: http://git.scottworley.com/vopamoi/blobdiff_plain/7b5b90b9a161fdeeb9842029a369d0484146ef4d..e1eb33ad260e5da0ec6859baa2368d8a08538e11:/vopamoi.ts?ds=inline diff --git a/vopamoi.ts b/vopamoi.ts index 5ac82ef..7c51935 100644 --- a/vopamoi.ts +++ b/vopamoi.ts @@ -77,6 +77,15 @@ const Model = { return target; }, + hasTag: function (task: Element, tag: string) { + for (const child of task.children) { + if (child.classList.contains("tag") && child.textContent === tag) { + return true; + } + } + return false; + }, + getPriority: function (task: Element): number { if (task.hasAttribute("data-priority")) { return parseFloat(task.getAttribute("data-priority")!); @@ -270,7 +279,9 @@ function BrowserUI() { input.removeEventListener("blur", this.completeTagEdit); task.removeChild(input); task.focus(); - ui.addTag(task.getAttribute("data-created")!, newTagName); + if (!Model.hasTag(task, newTagName)) { + ui.addTag(task.getAttribute("data-created")!, newTagName); + } }, firstVisibleTask: function () {