From 47fd2affa4e3e4684efc65f871f7047d19cd9266 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Tue, 6 Jan 2026 00:59:32 +0200 Subject: [PATCH] feat(tree): use direct DOM manipulation instead of jQuery --- apps/client/src/widgets/note_tree.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/apps/client/src/widgets/note_tree.ts b/apps/client/src/widgets/note_tree.ts index 9a2c61d22..742d6490a 100644 --- a/apps/client/src/widgets/note_tree.ts +++ b/apps/client/src/widgets/note_tree.ts @@ -153,7 +153,7 @@ const TPL = /*html*/` const MAX_SEARCH_RESULTS_IN_TREE = 100; // this has to be hanged on the actual elements to effectively intercept and stop click event -const cancelClickPropagation: (e: JQuery.ClickEvent) => void = (e) => e.stopPropagation(); +const cancelClickPropagation: (e: JQuery.ClickEvent | MouseEvent) => void = (e) => e.stopPropagation(); // TODO: Fix once we remove Node.js API from public type Timeout = NodeJS.Timeout | string | number | undefined; @@ -652,12 +652,11 @@ export default class NoteTreeWidget extends NoteContextAwareWidget { && !note.isLaunchBarConfig() && !note.noteId.startsWith("_help") ) { - const $createChildNoteButton = $(``).on( - "click", - cancelClickPropagation - ); - - $span.append($createChildNoteButton); + const createChildEl = document.createElement("span"); + createChildEl.className = "tree-item-button tn-icon add-note-button bx bx-plus"; + createChildEl.title = t("note_tree.create-child-note"); + createChildEl.addEventListener("click", cancelClickPropagation); + node.span.append(createChildEl); } if (isHoistedNote) {