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
style(menus): end switch rows where submenu arrows end
Elian Doranac943d564fbb
diff --git a/apps/client/src/widgets/react/FormList.css b/apps/client/src/widgets/react/FormList.cssindex 2e05a367aa..c9c66a35b2 100644--- a/apps/client/src/widgets/react/FormList.css+++ b/apps/client/src/widgets/react/FormList.css@@ -45,6 +45,12 @@}}+/* Ends the switch where a submenu row's arrow ends (see `.dropdown-submenu .dropdown-toggle::after`+ in theme-next/menus.css), rather than at the padding kept for that arrow. */+.dropdown-item.tn-menu-toggle {+ --menu-item-end-padding: 10px;+}+.form-list-row {display: grid;grid-template-columns: 1fr 1fr;diff --git a/apps/client/src/widgets/react/FormList.spec.tsx b/apps/client/src/widgets/react/FormList.spec.tsxindex dbf618b469..291c5e1ff7 100644--- a/apps/client/src/widgets/react/FormList.spec.tsx+++ b/apps/client/src/widgets/react/FormList.spec.tsx@@ -235,6 +235,16 @@ describe("FormListToggleableItem", () => {return { row, pageHeard };}+ it("marks its row as a switch row, alongside a class it is given", () => {+ const container = mount(+ <menu role="none">+ <FormListToggleableItem title="Shared" currentValue={false} onChange={() => {}} className="share-row" />+ </menu>+ );+ const row = container.querySelector<HTMLElement>("li.dropdown-item");+ expect([ row?.classList.contains("tn-menu-toggle"), row?.classList.contains("share-row") ]).toEqual([ true, true ]);+ });+it("flips its value once per click, ignoring clicks while the change is still running", async () => {let finish = () => {};const onChange = vi.fn(() => new Promise<void>((resolve) => finish = resolve));diff --git a/apps/client/src/widgets/react/FormList.tsx b/apps/client/src/widgets/react/FormList.tsxindex b795bb607f..d6c04a2019 100644--- a/apps/client/src/widgets/react/FormList.tsx+++ b/apps/client/src/widgets/react/FormList.tsx@@ -316,7 +316,7 @@ export function menuItemTooltipSide(_tooltip?: unknown, tip?: HTMLElement, row?:}export function FormListToggleableItem({- title, currentValue, onChange, disabled, helpPage, helpTooltip, ...props+ title, currentValue, onChange, disabled, helpPage, helpTooltip, className, ...props}: Omit<FormListItemOpts, "onClick" | "children"> & {title: string;currentValue: boolean;@@ -330,6 +330,7 @@ export function FormListToggleableItem({return (<FormListItem{...props}+ className={clsx("tn-menu-toggle", className)}title={helpTooltip}disabled={disabled}onClick={async (e) => {