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(react/dialogs): revision list not full height
Elian Doranabf1f6c04128
diff --git a/apps/client/src/widgets/dialogs/revisions.tsx b/apps/client/src/widgets/dialogs/revisions.tsxindex 5b774ce308..f5e0b203d1 100644--- a/apps/client/src/widgets/dialogs/revisions.tsx+++ b/apps/client/src/widgets/dialogs/revisions.tsx@@ -107,7 +107,7 @@ function RevisionsDialogComponent() {function RevisionsList({ revisions, onSelect, currentRevision }: { revisions: RevisionItem[], onSelect: (val: string) => void, currentRevision?: RevisionItem }) {return (- <FormList style={{ height: "100%", flexShrink: 0 }} onSelect={onSelect}>+ <FormList onSelect={onSelect} fullHeight>{revisions.map((item) =><FormListItemtitle={t("revisions.revision_last_edited", { date: item.dateLastEdited })}diff --git a/apps/client/src/widgets/react/FormList.tsx b/apps/client/src/widgets/react/FormList.tsxindex 9c7deade54..f3bf12ce40 100644--- a/apps/client/src/widgets/react/FormList.tsx+++ b/apps/client/src/widgets/react/FormList.tsx@@ -1,15 +1,16 @@import { Dropdown as BootstrapDropdown } from "bootstrap";import { ComponentChildren } from "preact";import Icon from "./Icon";-import { useEffect, useRef, type CSSProperties } from "preact/compat";+import { useEffect, useMemo, useRef, type CSSProperties } from "preact/compat";interface FormListOpts {children: ComponentChildren;onSelect?: (value: string) => void;style?: CSSProperties;+ fullHeight?: boolean;}-export default function FormList({ children, onSelect, style }: FormListOpts) {+export default function FormList({ children, onSelect, style, fullHeight }: FormListOpts) {const wrapperRef = useRef<HTMLDivElement | null>(null);const triggerRef = useRef<HTMLButtonElement | null>(null);@@ -28,9 +29,17 @@ export default function FormList({ children, onSelect, style }: FormListOpts) {}}, [ triggerRef, wrapperRef ]);+ const builtinStyles = useMemo(() => {+ const style: CSSProperties = {};+ if (fullHeight) {+ style.height = "100%";+ }+ return style;+ }, [ fullHeight ]);+return (- <div className="dropdownWrapper" ref={wrapperRef}>- <div className="dropdown">+ <div className="dropdownWrapper" ref={wrapperRef} style={builtinStyles}>+ <div className="dropdown" style={builtinStyles}><buttonref={triggerRef}type="button" style="display: none;"@@ -39,6 +48,7 @@ export default function FormList({ children, onSelect, style }: FormListOpts) {<div class="dropdown-menu static show" style={{...style ?? {},+ ...builtinStyles,position: "relative",}} onClick={(e) => {const value = (e.target as HTMLElement)?.dataset?.value;