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/modal dialog: add support for full page dialogs on mobile
Adorian Dorandbea88fa56a9
diff --git a/apps/client/src/stylesheets/style.css b/apps/client/src/stylesheets/style.cssindex c1672f50c4..f9bc58362e 100644--- a/apps/client/src/stylesheets/style.css+++ b/apps/client/src/stylesheets/style.css@@ -1666,6 +1666,21 @@ body:not(.mobile) #launcher-pane.horizontal .dropdown-submenu > .dropdown-menu {display: flex;}+ body.mobile .modal-dialog.modal-dialog-full-page-on-mobile {+ width: 100%;+ height: 100%;+ max-height: unset;++ .modal-content {+ border-radius: 0;+ border: 0;++ .modal-body {+ overflow: scroll;+ }+ }+ }+body.mobile .modal-content {overflow-y: auto;border-radius: var(--bs-modal-border-radius) var(--bs-modal-border-radius) 0 0;diff --git a/apps/client/src/widgets/react/Modal.tsx b/apps/client/src/widgets/react/Modal.tsxindex fcaa287380..0a3d35fa79 100644--- a/apps/client/src/widgets/react/Modal.tsx+++ b/apps/client/src/widgets/react/Modal.tsx@@ -77,9 +77,13 @@ export interface ModalProps {* If true, the modal will not focus itself after becoming visible.*/noFocus?: boolean;+ /**+ * Indicates if the dialog will be displayed as a full page on mobile devices.+ */+ isFullPageOnMobile?: boolean;}-export default function Modal({ children, className, size, title, customTitleBarButtons: titleBarButtons, header, footer, footerStyle, footerAlignment, onShown, onSubmit, helpPageId, minWidth, maxWidth, zIndex, scrollable, onHidden, modalRef: externalModalRef, formRef, bodyStyle, show, stackable, keepInDom, noFocus }: ModalProps) {+export default function Modal({ children, className, size, title, customTitleBarButtons: titleBarButtons, header, footer, footerStyle, footerAlignment, onShown, onSubmit, helpPageId, minWidth, maxWidth, zIndex, scrollable, onHidden, modalRef: externalModalRef, formRef, bodyStyle, show, stackable, keepInDom, noFocus, isFullPageOnMobile }: ModalProps) {const modalRef = useSyncedRef<HTMLDivElement>(externalModalRef);const modalInstanceRef = useRef<BootstrapModal>();const elementToFocus = useRef<Element | null>();@@ -143,7 +147,7 @@ export default function Modal({ children, className, size, title, customTitleBarreturn (<div className={`modal fade mx-auto ${className}`} tabIndex={-1} style={dialogStyle} role="dialog" ref={modalRef}>- {(show || keepInDom) && <div className={`modal-dialog modal-${size} ${scrollable ? "modal-dialog-scrollable" : ""}`} style={documentStyle} role="document">+ {(show || keepInDom) && <div className={clsx("modal-dialog", `modal-${size}`, {"modal-dialog-scrollable": scrollable, "modal-dialog-full-page-on-mobile": isFullPageOnMobile})} style={documentStyle} role="document"><div className="modal-content"><div className="modal-header">{!title || typeof title === "string" ? (