From 360beccbbfadcc25606af08d13d64fd878469ecc Mon Sep 17 00:00:00 2001 From: Scott Worley Date: Thu, 27 Jan 2022 13:34:30 -0800 Subject: [PATCH 1/1] Keep tags sorted --- vopamoi.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vopamoi.ts b/vopamoi.ts index 135fe0a..31a4cdc 100644 --- a/vopamoi.ts +++ b/vopamoi.ts @@ -60,6 +60,12 @@ const Model = { tag.classList.add("tag"); tag.setAttribute("tabindex", "0"); hashHue(tagName).then((hue) => (tag.style.backgroundColor = `hsl(${hue},90%,45%)`)); + for (const child of task.getElementsByClassName("tag")) { + if (tagName > child.textContent!) { + task.insertBefore(tag, child); + return tag; + } + } task.appendChild(tag); return tag; }, -- 2.44.1