Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
client/list view: extract event handler
Adorian Doran483c57029aeb
diff --git a/apps/client/src/widgets/collections/legacy/ListOrGridView.tsx b/apps/client/src/widgets/collections/legacy/ListOrGridView.tsxindex d024e8616b..f4750c6ef5 100644--- a/apps/client/src/widgets/collections/legacy/ListOrGridView.tsx+++ b/apps/client/src/widgets/collections/legacy/ListOrGridView.tsx@@ -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()+}