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
fix(breadcrumbs): menu dismisses on click
Elian Doranb3d92f932f7c
diff --git a/apps/client/src/widgets/layout/Breadcrumb.css b/apps/client/src/widgets/layout/Breadcrumb.cssindex 572392757b..8edebbe680 100644--- a/apps/client/src/widgets/layout/Breadcrumb.css+++ b/apps/client/src/widgets/layout/Breadcrumb.css@@ -57,7 +57,7 @@.bxs-chevron-right {transform: translateY(8%);-+&::before {opacity: .75;}@@ -87,7 +87,7 @@color: var(--custom-color, inherit) !important;}- .dropdown .breadcrumb-child-list {+ .dropdown.breadcrumb-child-list {/* Icon */li > span:first-child {opacity: .75;diff --git a/apps/client/src/widgets/layout/Breadcrumb.tsx b/apps/client/src/widgets/layout/Breadcrumb.tsxindex 24ad806ae4..08ded7c6ba 100644--- a/apps/client/src/widgets/layout/Breadcrumb.tsx+++ b/apps/client/src/widgets/layout/Breadcrumb.tsx@@ -193,7 +193,7 @@ function BreadcrumbSeparator(props: BreadcrumbSeparatorProps) {noSelectButtonStylebuttonClassName="icon-action"hideToggleArrow- dropdownContainerClassName="tn-dropdown-menu-scrollable"+ dropdownContainerClassName="tn-dropdown-menu-scrollable breadcrumb-child-list"dropdownOptions={{ popperConfig: { strategy: "fixed", placement: "top" } }}><BreadcrumbSeparatorDropdownContent {...props} />@@ -207,7 +207,7 @@ function BreadcrumbSeparatorDropdownContent({ notePath, noteContext, activeNotePconst childNotes = useChildNotes(parentNoteId);return (- <ul className="breadcrumb-child-list">+ <>{childNotes.map((note) => {if (note.noteId === "_hidden") return;if (hideArchivedNotes && note.isArchived) return null;@@ -231,7 +231,7 @@ function BreadcrumbSeparatorDropdownContent({ notePath, noteContext, activeNotePicon="bx bx-plus"onClick={() => note_create.createNote(notePath, { activate: true })}>{t("breadcrumb.create_new_note")}</FormListItem>- </ul>+ </>);}@@ -244,26 +244,25 @@ function BreadcrumbCollapsed({ items, noteContext }: {text={<Icon icon="bx bx-dots-horizontal-rounded" />}noSelectButtonStylebuttonClassName="icon-action"+ dropdownContainerClassName="breadcrumb-child-list"hideToggleArrowdropdownOptions={{ popperConfig: { strategy: "fixed" } }}>- <ul className="breadcrumb-child-list">- {items.map((notePath) => {- const notePathComponents = notePath.split("/");- const noteId = notePathComponents[notePathComponents.length - 1];- const note = froca.getNoteFromCache(noteId);- if (!note) return null;-- return <li key={note.noteId}>- <FormListItem- icon={note.getIcon()}- onClick={() => noteContext?.setNote(notePath)}- >- <span>{note.title}</span>- </FormListItem>- </li>;- })}- </ul>+ {items.map((notePath) => {+ const notePathComponents = notePath.split("/");+ const noteId = notePathComponents[notePathComponents.length - 1];+ const note = froca.getNoteFromCache(noteId);+ if (!note) return null;++ return <li key={note.noteId}>+ <FormListItem+ icon={note.getIcon()}+ onClick={() => noteContext?.setNote(notePath)}+ >+ <span>{note.title}</span>+ </FormListItem>+ </li>;+ })}</Dropdown>);}diff --git a/apps/client/src/widgets/react/FormList.tsx b/apps/client/src/widgets/react/FormList.tsxindex 84cc4d8c65..9c32e8878c 100644--- a/apps/client/src/widgets/react/FormList.tsx+++ b/apps/client/src/widgets/react/FormList.tsx@@ -205,7 +205,10 @@ export function FormListHeader({ text }: FormListHeaderOpts) {}export function FormDropdownDivider() {- return <div className="dropdown-divider" />;+ return <div+ className="dropdown-divider"+ onClick={e => e.stopPropagation()}+ />;}export function FormDropdownSubmenu({ icon, title, children, dropStart, onDropdownToggleClicked }: {