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(options): custom task states not opening due to modal
Elian Doran24fe61e0f5f4
diff --git a/apps/client/src/widgets/react/hooks.tsx b/apps/client/src/widgets/react/hooks.tsxindex 8627be21d7..672922d012 100644--- a/apps/client/src/widgets/react/hooks.tsx+++ b/apps/client/src/widgets/react/hooks.tsx@@ -1612,6 +1612,8 @@ export function useMathRendering(containerRef: RefObject<HTMLElement>, deps: unk* document-level `goToLink` handler (and before anything that might stop propagation). Modified or* middle clicks and external links are left untouched so they can still open in a new tab/window or* externally, and clicks inside editable rich text are ignored so they keep placing the caret.+ * Links that implement their own navigation (and would otherwise never see the click, since this+ * runs first) can opt out entirely via a `data-no-contained-navigation` attribute.*/export function useContainedLinkNavigation(containerRef: RefObject<HTMLElement>,@@ -1626,6 +1628,7 @@ export function useContainedLinkNavigation(const link = (e.target as HTMLElement).closest("a");if (!link || link.getAttribute("target") === "_blank" || link.isContentEditable) return;+ if (link.hasAttribute("data-no-contained-navigation")) return;const href = link.getAttribute("href") ?? link.getAttribute("data-href");if (!href?.startsWith("#root/")) return; // external links / in-page anchors handled elsewherediff --git a/apps/client/src/widgets/type_widgets/options/components/OptionsRow.tsx b/apps/client/src/widgets/type_widgets/options/components/OptionsRow.tsxindex df4e461682..5a165f292f 100644--- a/apps/client/src/widgets/type_widgets/options/components/OptionsRow.tsx+++ b/apps/client/src/widgets/type_widgets/options/components/OptionsRow.tsx@@ -39,11 +39,19 @@ interface OptionsRowLinkProps {description?: string;href: string;onClick?: (e: MouseEvent) => void;+ /** Opts out of the options dialog's contained link navigation (which runs before `onClick`),+ * so that `onClick` gets to handle the click itself. */+ noContainedNavigation?: boolean;}-export function OptionsRowLink({ label, description, href, onClick }: OptionsRowLinkProps) {+export function OptionsRowLink({ label, description, href, onClick, noContainedNavigation }: OptionsRowLinkProps) {return (- <a href={href} className="option-row option-row-link no-tooltip-preview" onClick={onClick}>+ <a+ href={href}+ className="option-row option-row-link no-tooltip-preview"+ onClick={onClick}+ data-no-contained-navigation={noContainedNavigation ? "" : undefined}+ ><div className="option-row-label"><label style={{ cursor: "pointer" }}>{label}</label>{description && <small className="option-row-description">{description}</small>}diff --git a/apps/client/src/widgets/type_widgets/options/components/RelatedSettings.tsx b/apps/client/src/widgets/type_widgets/options/components/RelatedSettings.tsxindex 7647e29bd1..c1dabc3983 100644--- a/apps/client/src/widgets/type_widgets/options/components/RelatedSettings.tsx+++ b/apps/client/src/widgets/type_widgets/options/components/RelatedSettings.tsx@@ -37,6 +37,7 @@ export default function RelatedSettings({ items }: RelatedSettingsProps) {href={targetNoteId? `#root/_hidden/${targetNoteId}`: `#root/_hidden/_options/${targetPage}`}+ noContainedNavigation={!!targetNoteId}onClick={targetNoteId? (e) => {// Hidden-subtree config notes open hoisted, in their own tab.