client/list view: extract event handler

This commit is contained in:
Adorian Doran 2026-02-15 19:10:31 +02:00
parent 7e6daf5b36
commit 483c57029a

View File

@ -19,6 +19,7 @@ import { JSX } from "preact/jsx-runtime";
import { clsx } from "clsx";
import ActionButton from "../../react/ActionButton";
import linkContextMenuService from "../../../menus/link_context_menu";
import { TargetedMouseEvent } from "preact";
export function ListView({ note, noteIds: unfilteredNoteIds, highlightedTokens }: ViewModeProps<{}>) {
const expandDepth = useExpansionDepth(note);
@ -140,7 +141,7 @@ function ListNoteCard({ note, parentNote, highlightedTokens, currentLevel, expan
<NoteAttributes note={note} />
<ActionButton className="nested-note-list-item-menu"
icon="bx bx-dots-vertical-rounded" text=""
onClick={(e) => {linkContextMenuService.openContextMenu(notePath, e); e.stopPropagation()}}
onClick={(e) => openNoteMenu(notePath, e)}
/>
</h5>
</CardSection>
@ -274,3 +275,8 @@ function useExpansionDepth(note: FNote) {
return parseInt(expandDepth, 10);
}
function openNoteMenu(notePath, e: TargetedMouseEvent<HTMLElement>) {
linkContextMenuService.openContextMenu(notePath, e);
e.stopPropagation()
}