feat(tree): use direct DOM manipulation instead of jQuery

This commit is contained in:
Elian Doran 2026-01-06 00:59:32 +02:00
parent 494b55d685
commit 47fd2affa4
No known key found for this signature in database

View File

@ -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 = $(`<span class="tree-item-button tn-icon add-note-button bx bx-plus" title="${t("note_tree.create-child-note")}"></span>`).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) {