]> git.scottworley.com Git - vopamoi/commitdiff
When creating a task while viewing a tag, the new task has that tag
authorScott Worley <scottworley@scottworley.com>
Thu, 10 Feb 2022 03:11:30 +0000 (19:11 -0800)
committerScott Worley <scottworley@scottworley.com>
Thu, 10 Feb 2022 17:51:51 +0000 (09:51 -0800)
vopamoi.ts

index 33e37a37e851db876b260dc14c406f6ebc5e6845..6ba608a4478481fbfcd6fb06f506f5b3ac439fbe 100644 (file)
@@ -276,6 +276,7 @@ function BrowserUI() {
     todo: "White",
     waiting: "MediumOrchid",
   };
     todo: "White",
     waiting: "MediumOrchid",
   };
+  var currentTagView: string | null = null;
   var currentViewState = "todo";
   var taskFocusedBeforeJumpingToInput: HTMLElement | null = null;
   var lastTagNameEntered = "";
   var currentViewState = "todo";
   var taskFocusedBeforeJumpingToInput: HTMLElement | null = null;
   var lastTagNameEntered = "";
@@ -291,6 +292,9 @@ function BrowserUI() {
         this.firstVisibleTask()?.focus();
       }
       input.value = "";
         this.firstVisibleTask()?.focus();
       }
       input.value = "";
+      if (currentTagView) {
+        ui.addTag(task.getAttribute("data-created")!, currentTagView);
+      }
       if (event.getModifierState("Control")) {
         this.makeBottomPriority(task);
       }
       if (event.getModifierState("Control")) {
         this.makeBottomPriority(task);
       }
@@ -464,6 +468,7 @@ function BrowserUI() {
     },
 
     resetTagView: function () {
     },
 
     resetTagView: function () {
+      currentTagView = null;
       for (const task of document.getElementsByClassName("task")) {
         task.classList.remove("hide");
       }
       for (const task of document.getElementsByClassName("task")) {
         task.classList.remove("hide");
       }
@@ -519,6 +524,7 @@ function BrowserUI() {
           task.classList.add("hide");
         }
       }
           task.classList.add("hide");
         }
       }
+      currentTagView = tag;
     },
 
     setView: function (state: string) {
     },
 
     setView: function (state: string) {