]> git.scottworley.com Git - vopamoi/commitdiff
"x" removes the first tag if a task, rather than a tag, is selected
authorScott Worley <scottworley@scottworley.com>
Fri, 28 Jan 2022 03:34:24 +0000 (19:34 -0800)
committerScott Worley <scottworley@scottworley.com>
Fri, 28 Jan 2022 03:34:24 +0000 (19:34 -0800)
vopamoi.ts

index 17d81b65150ced2b9bcdbf38d47af914a93d5656..fe97410107bbec955ca53324aca8176f912d6e31 100644 (file)
@@ -382,9 +382,14 @@ function BrowserUI() {
     },
 
     removeTag: function () {
-      const tag = document.activeElement;
-      if (!tag || !tag.classList.contains("tag")) return;
-      ui.removeTag(tag.parentElement!.getAttribute("data-created")!, tag.textContent!);
+      var target = document.activeElement;
+      if (!target) return;
+      if (target.classList.contains("task")) {
+        const tags = target.getElementsByClassName("tag");
+        target = tags[tags.length - 1];
+      }
+      if (!target || !target.classList.contains("tag")) return;
+      ui.removeTag(target.parentElement!.getAttribute("data-created")!, target.textContent!);
     },
 
     returnFocusAfterInput: function (): boolean {