}
},
+ currentTag: function (): Element | null {
+ var target = document.activeElement;
+ if (!target) return null;
+ if (target.classList.contains("task")) {
+ const tags = target.getElementsByClassName("tag");
+ target = tags[tags.length - 1];
+ }
+ if (!target || !target.classList.contains("tag")) return null;
+ return target;
+ },
+
firstVisibleTask: function () {
for (const task of document.getElementsByClassName("task")) {
const state = task.getAttribute("data-state");
},
removeTag: function () {
- var target = document.activeElement;
+ const target = this.currentTag();
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!);
},