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
refactor(client): share the geo map's note panel as EmbeddedNoteSurface
Elian Doran958fbff5919a
diff --git a/apps/client/src/stylesheets/theme-next-dark.css b/apps/client/src/stylesheets/theme-next-dark.cssindex cc77b2ed58..14fc8aa1cb 100644--- a/apps/client/src/stylesheets/theme-next-dark.css+++ b/apps/client/src/stylesheets/theme-next-dark.css@@ -481,11 +481,11 @@ body .todo-list input[type="checkbox"]:not(:checked):before {border-color: var(--muted-text-color) !important;}-/* A calendar event and a map marker shown as a sheet are the same thing the quick editor is — a+/* A calendar event and a map note shown as a sheet are the same thing the quick editor is — awhole note over whatever raised it — so they are tinted by the same colours. */.quick-edit-dialog-wrapper.with-hue,.calendar-event-sheet.with-hue,-.geo-detail-sheet.with-hue {+.tn-embedded-note-sheet.with-hue {--modal-background-color: hsl(var(--custom-color-hue), 8.8%, 11.2%);--modal-border-color: hsl(var(--custom-color-hue), 9.4%, 25.1%);--promoted-attribute-card-background-color: hsl(var(--custom-color-hue), 13.2%, 20.8%);@@ -508,10 +508,10 @@ body .todo-list input[type="checkbox"]:not(:checked):before {.note-split.with-hue,.quick-edit-dialog-wrapper.with-hue,-.geo-detail-pane.with-hue,+.tn-embedded-note-panel.with-hue,.calendar-event-popover.with-hue,.calendar-event-sheet.with-hue,-.geo-detail-sheet.with-hue,+.tn-embedded-note-sheet.with-hue,.nested-note-list-item.with-hue,.note-book-card.with-hue .note-book-header,.ck-template-icon.with-hue,@@ -537,7 +537,7 @@ body .todo-list input[type="checkbox"]:not(:checked):before {/** The surfaces that show a note over something else and frost what they stand on: the calendar's- * event card beside its chip, the geo map's marker pane over the map. Unlike the sheets and the+ * event card beside its chip, the note panes over the maps. Unlike the sheets and the* tooltip, their tint is stated with the alpha the plain surface already carries — an opaque tint* would leave the blur nothing to show through, which is the whole of what they are dressed as.*@@ -546,7 +546,7 @@ body .todo-list input[type="checkbox"]:not(:checked):before {* all of them reading the no-backdrop colour.*/.calendar-event-popover.with-hue,-.geo-detail-pane.with-hue {+.tn-embedded-note-panel.with-hue {--menu-background-color: hsl(var(--custom-color-hue), 15%, 14%, 0.85);--menu-background-color-no-backdrop: hsl(var(--custom-color-hue), 12%, 11.2%);--dropdown-border-color: hsl(var(--custom-color-hue), 12%, 26%);@@ -556,7 +556,7 @@ body .todo-list input[type="checkbox"]:not(:checked):before {/* A reader who turned backdrop effects off, which these must answer here rather than by the swapmade on the body above: that swap is resolved where it is stated, so what reaches the surface isthe plain opaque colour and not the tinted one the surface states on itself. */-body.backdrop-effects-disabled :is(.calendar-event-popover, .geo-detail-pane).with-hue {+body.backdrop-effects-disabled :is(.calendar-event-popover, .tn-embedded-note-panel).with-hue {--menu-background-color: var(--menu-background-color-no-backdrop);}diff --git a/apps/client/src/stylesheets/theme-next-light.css b/apps/client/src/stylesheets/theme-next-light.cssindex 02e7bbb61c..7f9e763ee9 100644--- a/apps/client/src/stylesheets/theme-next-light.css+++ b/apps/client/src/stylesheets/theme-next-light.css@@ -453,11 +453,11 @@--custom-bg-color: hsl(var(--custom-color-hue), 37%, 89%, 1);}-/* A calendar event and a map marker shown as a sheet are the same thing the quick editor is — a+/* A calendar event and a map note shown as a sheet are the same thing the quick editor is — awhole note over whatever raised it — so they are tinted by the same colours. */.quick-edit-dialog-wrapper.with-hue,.calendar-event-sheet.with-hue,-.geo-detail-sheet.with-hue,+.tn-embedded-note-sheet.with-hue,.note-tooltip.with-hue {--modal-background-color: hsl(var(--custom-color-hue), 56%, 96%);--modal-border-color: hsl(var(--custom-color-hue), 33%, 41%);@@ -476,10 +476,10 @@.note-split.with-hue,.quick-edit-dialog-wrapper.with-hue,-.geo-detail-pane.with-hue,+.tn-embedded-note-panel.with-hue,.calendar-event-popover.with-hue,.calendar-event-sheet.with-hue,-.geo-detail-sheet.with-hue,+.tn-embedded-note-sheet.with-hue,.nested-note-list-item.with-hue,.note-book-card.with-hue .note-book-header,.ck-template-icon.with-hue,@@ -505,7 +505,7 @@/** The surfaces that show a note over something else and frost what they stand on: the calendar's- * event card beside its chip, the geo map's marker pane over the map. Unlike the sheets and the+ * event card beside its chip, the note panes over the maps. Unlike the sheets and the* tooltip, their tint is stated with the alpha the plain surface already carries — an opaque tint* would leave the blur nothing to show through, which is the whole of what they are dressed as.*@@ -514,7 +514,7 @@* all of them reading the no-backdrop colour.*/.calendar-event-popover.with-hue,-.geo-detail-pane.with-hue {+.tn-embedded-note-panel.with-hue {--menu-background-color: hsl(var(--custom-color-hue), 56%, 96%, 0.85);--menu-background-color-no-backdrop: hsl(var(--custom-color-hue), 56%, 97%);--dropdown-border-color: hsl(var(--custom-color-hue), 30%, 78%);@@ -524,7 +524,7 @@/* A reader who turned backdrop effects off, which these must answer here rather than by the swapmade on the body above: that swap is resolved where it is stated, so what reaches the surface isthe plain opaque colour and not the tinted one the surface states on itself. */-body.backdrop-effects-disabled :is(.calendar-event-popover, .geo-detail-pane).with-hue {+body.backdrop-effects-disabled :is(.calendar-event-popover, .tn-embedded-note-panel).with-hue {--menu-background-color: var(--menu-background-color-no-backdrop);}diff --git a/apps/client/src/widgets/EmbeddedNotePane.css b/apps/client/src/widgets/EmbeddedNotePane.cssindex d66c7629a7..b74d1ca7e9 100644--- a/apps/client/src/widgets/EmbeddedNotePane.css+++ b/apps/client/src/widgets/EmbeddedNotePane.css@@ -77,3 +77,42 @@border-radius: 50%;}++.tn-overlay-panel.tn-embedded-note-panel {+ &:not(.with-hue) {+ --note-icon-custom-color: initial;+ --note-icon-custom-background-color: initial;+ --note-icon-hover-custom-background-color: initial;+ }++ .tn-overlay-panel-header > .title-row {+ box-sizing: content-box;+ padding-block: 9px;+ padding-inline-start: 9px;+ /* Clear of the maximize and close buttons laid over the end of the row (OverlayPanel.css). */+ padding-inline-end: 64px;+ border-bottom: 1px solid var(--main-border-color);+ }++ .tn-embedded-note-pane {+ padding-top: 0;+ }+}++.modal.tn-embedded-note-sheet {+ .modal-dialog {+ max-height: var(--tn-modal-max-height);+ height: 100%;+ }++ .modal-content {+ overflow: hidden;+ }++ .modal-body {+ display: flex;+ flex-direction: column;+ min-height: 0;+ overflow: auto;+ }+}diff --git a/apps/client/src/widgets/EmbeddedNotePane.tsx b/apps/client/src/widgets/EmbeddedNotePane.tsxindex 03ccbba14c..d8e39d05fb 100644--- a/apps/client/src/widgets/EmbeddedNotePane.tsx+++ b/apps/client/src/widgets/EmbeddedNotePane.tsx@@ -1,5 +1,6 @@import "./EmbeddedNotePane.css";+import clsx from "clsx";import { ComponentChildren, RefObject } from "preact";import { useContext, useEffect, useRef, useState } from "preact/hooks";@@ -11,18 +12,23 @@ import NoteColorPicker from "../menus/custom-items/NoteColorPicker";import linkContextMenu from "../menus/link_context_menu";import { t } from "../services/i18n";import link from "../services/link";+import { isMobile } from "../services/utils";+import TitleRow from "./layout/TitleRow";import ActionButton from "./react/ActionButton";import Dropdown, { DropdownPanel } from "./react/Dropdown";import { FormListItem } from "./react/FormList";-import { useNoteContext } from "./react/hooks";+import { useLegacyComponentElement, useNoteColorClass, useNoteContext } from "./react/hooks";+import Modal from "./react/Modal";+import OverlayPanel, { OverlayPanelBody } from "./react/OverlayPanel";import { NoteContextContext, ParentComponent } from "./react/react_utils";/*- * A note embedded in a pane of its host view — the geo map's marker pane, the calendar's detail- * dock: the note-context wiring such a pane needs to hold the real note widgets (TitleRow,- * PromotedAttributes, NoteDetail), and, in EmbeddedNotePane.css, the layout that fits them into a- * third of the width they are written for. The pane itself — where it stands, how it opens and- * closes, what it offers around the note — stays with the view that owns it.+ * A note embedded in a pane of its host view — the geo map's marker pane, the relation map's note+ * pane, the calendar's detail dock: the note-context wiring such a pane needs to hold the real note+ * widgets (TitleRow, PromotedAttributes, NoteDetail), and, in EmbeddedNotePane.css, the layout that+ * fits them into a third of the width they are written for. `EmbeddedNoteSurface` is the panel or+ * phone dialog both maps show the note on; where it stands, when it opens and closes and what it+ * offers around the note stay with the view that owns it.*//**@@ -354,3 +360,90 @@ export function NoteColorAction({ note, title }: { note: FNote; title: string })</DropdownPanel>);}++interface EmbeddedNoteSurfaceProps {+ note: FNote;+ /** The panel's class on desktop, which places it over the host view. */+ panelClassName: string;+ /** The dialog's class on a phone. */+ sheetClassName: string;+ /** The class of the body that holds the note, next to the shared `tn-embedded-note-pane`. */+ bodyClassName: string;+ /** The tooltip of the panel's close button. */+ closeText: string;+ /** Lets the desktop panel grow over the host view. A phone always shows the whole dialog. */+ maximize?: {+ maximized: boolean;+ onChange(maximized: boolean): void;+ expandText: string;+ restoreText: string;+ };+ onClose(): void;+ /** See {@link useFollowLinksWithin}. */+ onFollowLink(noteId: string): boolean;+ /** The pane's contents, usually a row of actions, `PromotedAttributes` and `NoteDetail`. */+ children: ComponentChildren;+}++/**+ * The surface an embedded note is shown on: an {@link OverlayPanel} headed by the note's+ * `TitleRow` on desktop, or a `Modal` on a phone, which has no room for a panel beside the host+ * view. Render it inside the pane's {@link EmbeddedNoteScope}.+ */+export function EmbeddedNoteSurface(props: EmbeddedNoteSurfaceProps) {+ return isMobile() ? <EmbeddedNoteSheet {...props} /> : <EmbeddedNotePanel {...props} />;+}++function EmbeddedNotePanel({ note, panelClassName, bodyClassName, closeText, maximize, onClose, onFollowLink, children }: EmbeddedNoteSurfaceProps) {+ const paneRef = useRef<HTMLDivElement>(null);+ // The note's own colour, not the hue of the split the host view stands in.+ const colorClass = useNoteColorClass(note);+ // The text editor resolves its host component from the DOM. Without this mark it reaches the+ // widget around the host view, which does not answer calls such as `loadReferenceLinkTitle`.+ useLegacyComponentElement(paneRef);+ useFollowLinksWithin(paneRef, onFollowLink);+ const maximized = !!maximize?.maximized;++ return (+ <OverlayPanel+ containerRef={paneRef}+ className={clsx("tn-embedded-note-panel", panelClassName, colorClass)}+ header={<TitleRow compact />}+ maximized={maximized}+ headerActions={maximize && (+ <MaximizeAction+ icon={maximized ? "bx bx-collapse-alt" : "bx bx-expand-alt"}+ text={maximized ? maximize.restoreText : maximize.expandText}+ onClick={() => maximize.onChange(!maximized)}+ />+ )}+ close={{ text: closeText, onClick: onClose }}+ >+ <OverlayPanelBody className={clsx("tn-embedded-note-pane", bodyClassName, maximized && "tn-embedded-note-pane-wide")}>+ {children}+ </OverlayPanelBody>+ </OverlayPanel>+ );+}++function EmbeddedNoteSheet({ note, sheetClassName, bodyClassName, onClose, onFollowLink, children }: EmbeddedNoteSurfaceProps) {+ const modalRef = useRef<HTMLDivElement>(null);+ const colorClass = useNoteColorClass(note);+ useLegacyComponentElement(modalRef);+ useFollowLinksWithin(modalRef, onFollowLink);++ return (+ <Modal+ className={clsx("tn-embedded-note-sheet", sheetClassName, colorClass)}+ size="lg"+ title={<TitleRow />}+ modalRef={modalRef}+ show+ onHidden={onClose}+ >+ <div className={clsx("tn-embedded-note-pane", bodyClassName)}>+ {children}+ </div>+ </Modal>+ );+}diff --git a/apps/client/src/widgets/collections/geomap/DetailPane.css b/apps/client/src/widgets/collections/geomap/DetailPane.cssindex 21d381f328..57a2f021d4 100644--- a/apps/client/src/widgets/collections/geomap/DetailPane.css+++ b/apps/client/src/widgets/collections/geomap/DetailPane.css@@ -23,7 +23,7 @@are not equally free, so each is taken off by its own name rather than one of them twice. */max-width: calc(100% - var(--geo-map-inset-start) - var(--geo-map-inset-end));- /* Grown over the map (see the maximize in MarkerDetails). Only the width gives: the pane+ /* Grown over the map (see the maximize in `EmbeddedNoteSurface`). Only the width gives: the panealready stands the height of the map. What the map places around the pane is suppressedwhile it is grown rather than recomputed — see `maximized` in DetailPane.tsx. */&.maximized {@@ -33,44 +33,6 @@z-index: 3;}-/*- * A marker of no colour of its own wears none.- *- * The pane stands inside the map's note split, which carries the map note's colour, so the icon- * would otherwise be dressed in a hue belonging to another note entirely — the very thing the- * marker's own class overrides where it has one (see the `.geo-detail-pane.with-hue` rules in- * theme-next-{light,dark}.css). `initial` rather than `unset`: these are inherited properties, so- * unsetting them would let the split's values through again; made invalid, each `var()` falls back- * to the plain icon colour it names.- */-.geo-map-container .geo-detail-pane:not(.with-hue) {- --note-icon-custom-color: initial;- --note-icon-custom-background-color: initial;- --note-icon-hover-custom-background-color: initial;-}--/*- * The app's own title row heads the pane (see TitleRow), so a note is renamed from a marker the way- * it is renamed anywhere else. It brings no placing of its own, the shared panel giving that only to- * its own heading, so the padding and the rule under it are handed over here.- */-.geo-map-container .geo-detail-pane .tn-overlay-panel-header > .title-row {- box-sizing: content-box;- padding-block: 9px;- padding-inline-start: 9px;- /* Clear of the maximize and close buttons laid over the end of the row (see OverlayPanel.css). */- padding-inline-end: 64px;- border-bottom: 1px solid var(--main-border-color);-}--/*- * The pane's one body: the row of actions, then the note itself — the note's own widgets laid out- * by the shared class (see EmbeddedNotePane.css), which also brings the column they stand in.- */-.geo-map-container .geo-detail-pane .geo-detail-pane-body {- padding-top: 0;-}-/** Where the marker stands, reading as a subtitle to the name above it rather than as one more thing* to press: it is a line of text that happens to answer to a click, so it stands on no plate of its@@ -98,19 +60,3 @@color: var(--main-text-color);}}--.modal.geo-detail-sheet .modal-dialog {- max-height: var(--tn-modal-max-height);- height: 100%;-}--.modal.geo-detail-sheet .modal-content {- overflow: hidden;-}--.modal.geo-detail-sheet .modal-body {- display: flex;- flex-direction: column;- min-height: 0;- overflow: auto;-}diff --git a/apps/client/src/widgets/collections/geomap/DetailPane.tsx b/apps/client/src/widgets/collections/geomap/DetailPane.tsxindex c0c680c227..76f3f701b4 100644--- a/apps/client/src/widgets/collections/geomap/DetailPane.tsx+++ b/apps/client/src/widgets/collections/geomap/DetailPane.tsx@@ -1,6 +1,5 @@import "./DetailPane.css";-import clsx from "clsx";import type { EaseToOptions, GeoJSONSource, MapGeoJSONFeature, Map as MapLibreGLMap, MapMouseEvent, MapSourceDataEvent } from "maplibre-gl";import { useCallback, useContext, useEffect, useMemo, useRef } from "preact/hooks";@@ -9,14 +8,11 @@ import { copyTextWithToast } from "../../../services/clipboard_ext";import { t } from "../../../services/i18n";import link from "../../../services/link";import { isMobile } from "../../../services/utils";-import { announceEmbeddedNoteClosing, EmbeddedNoteActions, EmbeddedNoteScope, MaximizeAction, NoteColorAction, OpenNoteActions, SelectTitleOnFirstOpen, useEmbeddedNoteContext, useFollowLinksWithin } from "../../EmbeddedNotePane";-import TitleRow from "../../layout/TitleRow";+import { announceEmbeddedNoteClosing, EmbeddedNoteActions, EmbeddedNoteScope, EmbeddedNoteSurface, NoteColorAction, OpenNoteActions, SelectTitleOnFirstOpen, useEmbeddedNoteContext } from "../../EmbeddedNotePane";import NoteDetail from "../../NoteDetail";import PromotedAttributes from "../../PromotedAttributes";import ActionButton from "../../react/ActionButton";-import { useLegacyComponentElement, useNoteColorClass, useNoteLabel, useStaticTooltip } from "../../react/hooks";-import Modal from "../../react/Modal";-import OverlayPanel, { OverlayPanelBody } from "../../react/OverlayPanel";+import { useNoteLabel, useStaticTooltip } from "../../react/hooks";import { removeFromMap } from "./api";import { type Bounds, boundsOf } from "./coordinates";import { GPX_MIME, trackSourceId } from "./GpxTrack";@@ -77,7 +73,7 @@ export default function DetailPane({ notes, parentNote, placing, isReadOnly, sel/** Arms this map for the selected marker to be put somewhere else, the next click being where. */onRelocate: (noteId: string) => void;/**- * The pane has been grown to cover the map (see {@link MaximizeAction} in the header below).+ * The pane has been grown to cover the map (see the maximize in `EmbeddedNoteSurface`).* Owned by the map view rather than by the pane for the reason the selection is: the map places* what it draws around the pane, and a pane covering the whole of it leaves nothing to place* around — the marker previews have nowhere to stand clear to (see Tooltips), and the camera@@ -123,7 +119,7 @@ export default function DetailPane({ notes, parentNote, placing, isReadOnly, sel* Follows a link inside the pane whose note stands on this map: the pane switches to it — the* map panning along, through the easing effect below — the same as if its marker had been* clicked. Answers whether the note stands on the map at all, a link to anything else keeping- * its ordinary meaning (see the interception in MarkerDetails).+ * its ordinary meaning (see `useFollowLinksWithin`).*/const followLink = useCallback((noteId: string) => {const target = notes.find((n) => n.noteId === noteId);@@ -285,18 +281,23 @@ export default function DetailPane({ notes, parentNote, placing, isReadOnly, sel// EmbeddedNotePane) — the map would otherwise rebind to the marker's note, tear the map// down and take the WebGL context with it.<EmbeddedNoteScope component={paneComponent} noteContext={noteContext}>- {isMobile() ? (- <MarkerSheet- note={note} parentNote={parentNote} isReadOnly={isReadOnly}- onClose={closePane} onRelocate={relocate} onFollowLink={followLink}- />- ) : (- <MarkerDetails- note={note} parentNote={parentNote} isReadOnly={isReadOnly}- maximized={maximized} onMaximizedChange={onMaximizedChange}- onClose={closePane} onRelocate={relocate} onFollowLink={followLink}- />- )}+ <EmbeddedNoteSurface+ note={note}+ panelClassName="geo-detail-pane"+ sheetClassName="geo-detail-sheet"+ bodyClassName="geo-detail-pane-body"+ closeText={t("geo-map.close-details")}+ maximize={{+ maximized,+ onChange: onMaximizedChange,+ expandText: t("geo-map.expand-details"),+ restoreText: t("geo-map.restore-details")+ }}+ onClose={closePane}+ onFollowLink={followLink}+ >+ <MarkerContents note={note} parentNote={parentNote} isReadOnly={isReadOnly} onRelocate={relocate} />+ </EmbeddedNoteSurface>{selection?.isNew && <SelectTitleOnFirstOpen />}</EmbeddedNoteScope>);@@ -424,111 +425,6 @@ function fitPadding(map: MapLibreGLMap) {return padding;}-/** The pane itself, for a marker there is one to draw. */-function MarkerDetails({ note, parentNote, isReadOnly, maximized, onMaximizedChange, onClose, onRelocate, onFollowLink }: {- note: FNote;- parentNote: FNote;- isReadOnly: boolean;- maximized: boolean;- onMaximizedChange(maximized: boolean): void;- onClose(): void;- onRelocate(): void;- /** Offered a link's note; answers whether the map took the navigation over. */- onFollowLink(noteId: string): boolean;-}) {- // The marker's own colour, which is what dresses its icon (see DetailPane.css) — as the quick- // editor's wrapper carries it. Without it the pane would inherit the hue of the note split it- // stands in, which is the map's colour and not the marker's.- const colorClass = useNoteColorClass(note);-- /*- * The pane stands for its component in the DOM, which is how the text editor finds its host:- * every call it makes back into the app resolves one from the element it is mounted in (see- * `useLegacyComponentElement`). The pane provides a component of its own — the whole point of it- * being a component is that the map does not hear the pane's note switches — so without this the- * editor arrives at the widget enclosing the map instead, which answers to none of what it asks- * for: a note carrying a reference link died on `loadReferenceLinkTitle is not a function`.- */- const paneRef = useRef<HTMLDivElement>(null);- useLegacyComponentElement(paneRef);-- // Links followed within the pane: one pointing at another marker of this map switches the pane- // to it, the map panning along, instead of navigating the whole tab away (see the shared hook).- useFollowLinksWithin(paneRef, onFollowLink);-- return (- <OverlayPanel- containerRef={paneRef}- className={clsx("geo-detail-pane", colorClass)}- header={<TitleRow compact />}- maximized={maximized}- headerActions={- <MaximizeAction- icon={maximized ? "bx bx-collapse-alt" : "bx bx-expand-alt"}- text={maximized ? t("geo-map.restore-details") : t("geo-map.expand-details")}- onClick={() => onMaximizedChange(!maximized)}- />- }- close={{ text: t("geo-map.close-details"), onClick: onClose }}- >- {/* Grown over the map, the pane has a note's width, so what it holds is laid out for one- (see `tn-embedded-note-pane-wide` in EmbeddedNotePane.css). */}- <OverlayPanelBody className={clsx("geo-detail-pane-body tn-embedded-note-pane", maximized && "tn-embedded-note-pane-wide")}>- <MarkerContents note={note} parentNote={parentNote} isReadOnly={isReadOnly} onRelocate={onRelocate} />- </OverlayPanelBody>- </OverlayPanel>- );-}--/**- * The marker as a phone shows it: the sheet the app raises its dialogs as, rather than a pane laid- * over the map. A pane holding a whole note takes most of a phone's screen whatever is done to it,- * so one drawn over the map leaves the map neither readable nor reachable — and the maximize that- * would give it the rest of the screen has nothing left to give. The note is shown as a note- * instead, and the map is left alone behind it (see the camera above).- *- * Dressed as the quick editor and the calendar's own sheet are, those being the app's ways of- * showing a whole note over whatever raised it (see the shared rules in PopupEditor.css).- *- * `show` is not a state because every way out of this dialog is also a way out of the selection:- * what answers `onHidden` clears it, and the sheet goes with it. Bootstrap is told to hide as the- * element leaves the tree, so nothing is left dimming the page behind it (see Modal).- */-function MarkerSheet({ note, parentNote, isReadOnly, onClose, onRelocate, onFollowLink }: {- note: FNote;- parentNote: FNote;- isReadOnly: boolean;- onClose(): void;- onRelocate(): void;- onFollowLink(noteId: string): boolean;-}) {- // Marked on the dialog rather than on its body, so that what heads it — the note's own title- // row, handed to the dialog — is inside the marked element too (see the pane above).- const modalRef = useRef<HTMLDivElement>(null);- useLegacyComponentElement(modalRef);- useFollowLinksWithin(modalRef, onFollowLink);-- // Tinted by the marker's own colour as the pane over the map is, and by the same means the- // quick editor is (see the `.with-hue` rules in theme-next-{light,dark}.css) — a sheet being- // opaque, it takes the dialog's colours rather than the pane's.- const colorClass = useNoteColorClass(note);-- return (- <Modal- className={clsx("geo-detail-sheet", colorClass)}- size="lg"- title={<TitleRow />}- modalRef={modalRef}- show- onHidden={onClose}- >- <div className="geo-detail-pane-body tn-embedded-note-pane">- <MarkerContents note={note} parentNote={parentNote} isReadOnly={isReadOnly} onRelocate={onRelocate} />- </div>- </Modal>- );-}-/** What is shown of the marker, under whatever heads it. Shared by the pane and the sheet, which* differ only in what they put around this and how they are dismissed. */function MarkerContents({ note, parentNote, isReadOnly, onRelocate }: {diff --git a/apps/client/src/widgets/dialogs/PopupEditor.css b/apps/client/src/widgets/dialogs/PopupEditor.cssindex 00fe43d33b..5058368013 100644--- a/apps/client/src/widgets/dialogs/PopupEditor.css+++ b/apps/client/src/widgets/dialogs/PopupEditor.css@@ -46,13 +46,13 @@ body.mobile .modal.popup-editor-dialog .modal-dialog {}/* The note-title header (icon + editable title) is shared with the tree popup, the calendar's event- sheet and the geo map's marker sheet, which reuse the same TitleRow; keep the selectors together+ sheet and the map panes' sheets, which reuse the same TitleRow; keep the selectors togetherso the dialogs stay pixel-identical. This file is loaded wherever the app is: the quick editorkeeps itself in the DOM and so is never lazily loaded (see layout_commons.tsx). */.modal.popup-editor-dialog .modal-header .title-row,.modal.tree-popup-editor-dialog .modal-header .title-row,.modal.calendar-event-sheet .modal-header .title-row,-.modal.geo-detail-sheet .modal-header .title-row {+.modal.tn-embedded-note-sheet .modal-header .title-row {flex-grow: 1;display: flex;align-items: center;@@ -68,7 +68,7 @@ body.mobile .modal.popup-editor-dialog .modal-dialog {.modal.popup-editor-dialog .modal-header .note-title-widget,.modal.tree-popup-editor-dialog .modal-header .note-title-widget,.modal.calendar-event-sheet .modal-header .note-title-widget,-.modal.geo-detail-sheet .modal-header .note-title-widget {+.modal.tn-embedded-note-sheet .modal-header .note-title-widget {display: flex;align-items: center;}@@ -99,8 +99,8 @@ body.mobile .modal.popup-editor-dialog .modal-dialog {.modal.tree-popup-editor-dialog .note-icon-widget,.modal.calendar-event-sheet .title-row,.modal.calendar-event-sheet .note-icon-widget,-.modal.geo-detail-sheet .title-row,-.modal.geo-detail-sheet .note-icon-widget {+.modal.tn-embedded-note-sheet .title-row,+.modal.tn-embedded-note-sheet .note-icon-widget {height: 32px;min-height: unset;}@@ -108,7 +108,7 @@ body.mobile .modal.popup-editor-dialog .modal-dialog {:root div.modal.popup-editor-dialog div.note-title-widget,:root div.modal.tree-popup-editor-dialog div.note-title-widget,:root div.modal.calendar-event-sheet div.note-title-widget,-:root div.modal.geo-detail-sheet div.note-title-widget {+:root div.modal.tn-embedded-note-sheet div.note-title-widget {--note-title-padding-inline: 8px;}@@ -118,8 +118,8 @@ body.mobile .modal.popup-editor-dialog .modal-dialog {.modal.tree-popup-editor-dialog .note-title-widget input.note-title,.modal.calendar-event-sheet .note-icon-widget button.note-icon,.modal.calendar-event-sheet .note-title-widget input.note-title,-.modal.geo-detail-sheet .note-icon-widget button.note-icon,-.modal.geo-detail-sheet .note-title-widget input.note-title {+.modal.tn-embedded-note-sheet .note-icon-widget button.note-icon,+.modal.tn-embedded-note-sheet .note-title-widget input.note-title {font-size: 1em;}