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
feat(calendar): offer the marker pane's actions on a docked event
Elian Doran0a52c661a879
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.jsonindex 99f772d032..fcf3a15f04 100644--- a/apps/client/src/translations/en/translation.json+++ b/apps/client/src/translations/en/translation.json@@ -1006,7 +1006,29 @@"today": "Today","pin_date": "Pin the current date so the calendar always opens on this interval instead of today","unpin_date": "Unpin the date so the calendar opens on today's date again",- "close_details": "Close event details"+ "close_details": "Close event details",+ "recurrence": {+ "repeats": "Repeats",+ "does_not_repeat": "Does not repeat",+ "daily": "Daily",+ "weekly": "Weekly",+ "monthly": "Monthly",+ "yearly": "Yearly",+ "custom": "Custom",+ "repeat_every": "Repeat every",+ "unit_days": "days",+ "unit_weeks": "weeks",+ "unit_months": "months",+ "unit_years": "years",+ "on_days": "On days",+ "ends": "Ends",+ "never": "Never",+ "until": "On date",+ "count": "After",+ "times": "times",+ "custom_rule": "Rule",+ "custom_hint": "An iCalendar recurrence rule (RRULE) that says more than the fields above can. Clearing it stops the repetition."+ }},"close_pane_button": {"close_this_pane": "Close this pane"@@ -2790,11 +2812,13 @@"fullscreen": "Fullscreen","exit-fullscreen": "Exit fullscreen","close-details": "Close",- "open-note": "Open note",- "more-ways-to-open": "More ways to open","marker-color": "Marker color","copy-coordinates": "Copy coordinates"},+ "embedded_note": {+ "open-note": "Open note",+ "more-ways-to-open": "More ways to open"+ },"geo-map-context": {"open-location": "Open location","move-marker": "Move to another location",@@ -3157,6 +3181,9 @@},"calendar_view": {"delete_note": "Delete note...",+ "event_color": "Event color",+ "remove_from_calendar": "Remove from calendar",+ "remove_from_calendar_confirmation": "Are you sure you want to remove the event \"{{title}}\" from the calendar?","time_slots": "Time slots","slot_duration": "Duration","slot_label_interval": "Label interval",diff --git a/apps/client/src/widgets/EmbeddedNotePane.css b/apps/client/src/widgets/EmbeddedNotePane.cssindex 1f92b08209..f8d58d8387 100644--- a/apps/client/src/widgets/EmbeddedNotePane.css+++ b/apps/client/src/widgets/EmbeddedNotePane.css@@ -80,4 +80,23 @@.promoted-attributes-widget:not(:has(.promoted-attribute-cell)) {display: none;}++ /* The row of actions at the head of the pane (see EmbeddedNoteActions). */+ .tn-embedded-note-actions {+ display: flex;+ align-items: center;+ gap: 4px;++ /* Those that write rather than read stand apart from the ones being reached for repeatedly,+ so the pointer cannot land on one of them by being a moment early. The gap falls before+ the first of them, which is the colour: they are drawn together or not at all, a+ read-only host having none of them. */+ .tn-embedded-note-color {+ margin-inline-start: auto;+ }+ }+}++:root .tn-embedded-note-pane .tn-embedded-note-remove.icon-action {+ color: var(--dropdown-item-icon-destructive-color);}diff --git a/apps/client/src/widgets/EmbeddedNotePane.tsx b/apps/client/src/widgets/EmbeddedNotePane.tsxindex ce4fc83ce7..a061166e5b 100644--- a/apps/client/src/widgets/EmbeddedNotePane.tsx+++ b/apps/client/src/widgets/EmbeddedNotePane.tsx@@ -5,8 +5,14 @@ import { useContext, useEffect, useState } from "preact/hooks";import appContext from "../components/app_context";import Component from "../components/component";-import NoteContext from "../components/note_context";+import NoteContext, { openInCurrentNoteContext } from "../components/note_context";import FNote from "../entities/fnote";+import NoteColorPicker from "../menus/custom-items/NoteColorPicker";+import linkContextMenu from "../menus/link_context_menu";+import { t } from "../services/i18n";+import ActionButton from "./react/ActionButton";+import Dropdown from "./react/Dropdown";+import { FormListItem } from "./react/FormList";import { NoteContextContext, ParentComponent } from "./react/react_utils";/*@@ -105,3 +111,116 @@ export function EmbeddedNoteScope({ component, noteContext, children }: {</ParentComponent.Provider>);}++/**+ * The row of actions at the head of the pane: the ways of opening the note, then whatever the host+ * offers to change about it. Named by tooltips rather than labels, as every other row of actions in+ * a panel is: labels would wrap a handful of buttons onto two lines at this width.+ */+export function EmbeddedNoteActions({ children }: { children: ComponentChildren }) {+ return <div className="tn-embedded-note-actions">{children}</div>;+}++/**+ * The ways of opening the pane's note. One stands out — into the tab the host view is in — and the+ * rest are gathered behind the button beside it: spread across the row they read as unrelated+ * things when they are one thing with several destinations, and the menu they are gathered into is+ * the app's own, so the pane offers exactly what a link offers anywhere else rather than a+ * hand-kept subset of it.+ *+ * The quick editor is in that menu but not in the row: it is what a click on the note's marker or+ * chip used to raise, and the pane took that click over — offering it here would put a modal back+ * over the pane that replaced it.+ */+export function OpenNoteActions({ note }: { note: FNote }) {+ const hoistedNoteId = appContext.tabManager.getActiveContext()?.hoistedNoteId;+ // A path rather than an id: a note may hang in several places, and each of these opens a path.+ const notePath = note.getBestNotePathString(hoistedNoteId);++ return (+ <>+ <ActionButton+ icon="bx bx-log-in"+ text={t("embedded_note.open-note")}+ // Handed the event: `openInCurrentNoteContext` reads the target tab off the element+ // clicked, which lands the note in the tab the host view is in.+ onClick={(e) => notePath && openInCurrentNoteContext(e as MouseEvent, notePath)}+ disabled={!notePath}+ />++ {/* A dropdown and not the menu the note's own right-click raises — that one is shown at+ a point and dismissed by the next press on the document, and the press that opened+ it from inside the panel is that press. */}+ <Dropdown+ className="tn-embedded-note-more"+ buttonClassName="bx bx-dots-horizontal-rounded"+ title={t("embedded_note.more-ways-to-open")}+ iconAction+ hideToggleArrow+ noDropdownListStyle+ // The panel clips what overflows it, so a menu nested in the row would be cut off at+ // its edge; and a panel's backdrop filter would flatten the menu's own.+ portalToBody+ disabled={!notePath}+ >+ {OTHER_WAYS_TO_OPEN.map(({ command, icon, title }) => (+ <FormListItem+ key={command}+ icon={icon}+ onClick={(e) => notePath && linkContextMenu.handleLinkContextMenuItem(+ command, e as MouseEvent, notePath, {}, hoistedNoteId ?? null)}+ >+ {title()}+ </FormListItem>+ ))}+ </Dropdown>+ </>+ );+}++/**+ * The ways of opening a note other than in the tab one is already in, which the split hides behind+ * its arrow. The same four a link offers anywhere in the app, and each is carried out by the app's+ * own handler — only the naming of them is repeated here.+ *+ * Repeated because `linkContextMenu.getItems` asks for the event that raised it, which a menu drawn+ * before anything is pressed does not have. What it wants the event for is one mobile-only wording,+ * so the loss is a label rather than behaviour. The titles are thunks so they are translated when+ * the menu is drawn rather than when this module loads.+ */+export const OTHER_WAYS_TO_OPEN = [+ { command: "openNoteInNewTab", icon: "bx bx-link-external", title: () => t("link_context_menu.open_note_in_new_tab") },+ // The one worth having beside a collection view most of all: what the view shows stays on show+ // while the note is read beside it.+ { command: "openNoteInNewSplit", icon: "bx bx-dock-right", title: () => t("link_context_menu.open_note_in_new_split") },+ { command: "openNoteInNewWindow", icon: "bx bx-window-open", title: () => t("link_context_menu.open_note_in_new_window") },+ // The quick editor, which is what a click on the note used to raise before the pane took that+ // click over. Kept because the note's own right-click menu offers it and the two should agree —+ // it is a way of opening the note that happens to stand over the pane, not a rival to it.+ { command: "openNoteInPopup", icon: "bx bx-edit", title: () => t("link_context_menu.open_note_in_popup") }+] as const;++/**+ * The colour the note's marker, chip or card is drawn in, which the pane already wears in its title+ * but would otherwise have no way of setting — the right-click menu was the only place it could be+ * reached. Named by the host: what the colour dresses is the host's to say (a marker, an event).+ *+ * Sent to the body because a panel may clip what overflows it or carry a backdrop filter, either of+ * which would be enough to cut the menu off or flatten its own frosting (see the Dropdown notes in+ * CLAUDE.md).+ */+export function NoteColorAction({ note, title }: { note: FNote; title: string }) {+ return (+ <Dropdown+ className="tn-embedded-note-color"+ buttonClassName="bx bx-palette"+ title={title}+ iconAction+ hideToggleArrow+ noDropdownListStyle+ portalToBody+ >+ <NoteColorPicker note={note} />+ </Dropdown>+ );+}diff --git a/apps/client/src/widgets/collections/calendar/DetailDock.tsx b/apps/client/src/widgets/collections/calendar/DetailDock.tsxindex b5695c416d..cf70641776 100644--- a/apps/client/src/widgets/collections/calendar/DetailDock.tsx+++ b/apps/client/src/widgets/collections/calendar/DetailDock.tsx@@ -5,12 +5,13 @@ import { useEffect, useRef, useState } from "preact/hooks";import FNote from "../../../entities/fnote";import { t } from "../../../services/i18n";-import { announceEmbeddedNoteClosing, EmbeddedNoteScope, useEmbeddedNoteContext } from "../../EmbeddedNotePane";+import { announceEmbeddedNoteClosing, EmbeddedNoteActions, EmbeddedNoteScope, NoteColorAction, OpenNoteActions, useEmbeddedNoteContext } from "../../EmbeddedNotePane";import TitleRow from "../../layout/TitleRow";import NoteDetail from "../../NoteDetail";import PromotedAttributes from "../../PromotedAttributes";import ActionButton from "../../react/ActionButton";import { useLegacyComponentElement, useNote } from "../../react/hooks";+import { removeFromCalendar } from "./api";/*** The dates the calendar already draws the event by, so their fields are not repeated in the dock.@@ -22,9 +23,14 @@ const EVENT_DATE_LABELS = [ "startDate", "endDate", "startTime", "endTime" ];* A pane docked at the trailing edge of the calendar, holding the note of the selected event — the* calendar reflowing beside it as it comes and goes.*/-export default function DetailDock({ noteId, onClose }: {+export default function DetailDock({ noteId, parentNote, isEditable, onClose }: {/** The note of the selected event, or `null` for a dock that is closed. */noteId: string | null;+ /** The calendar's own note, which is how the tree is told what the calendar holds a note by. */+ parentNote: FNote;+ /** The calendar may not be edited, which leaves the dock the ways of opening a note and no+ * more — a calendar root's day notes are not events to be recoloured or taken off it. */+ isEditable: boolean;onClose(): void;}) {const note = useNote(noteId ?? undefined);@@ -65,7 +71,7 @@ export default function DetailDock({ noteId, onClose }: {>{contentNote && (<EmbeddedNoteScope component={dockComponent} noteContext={noteContext}>- <DockContent onClose={onClose} />+ <DockContent note={contentNote} parentNote={parentNote} isEditable={isEditable} onClose={onClose} /></EmbeddedNoteScope>)}</div>@@ -76,7 +82,12 @@ export default function DetailDock({ noteId, onClose }: {const DOCK_NTX_ID = "_calendar-detail-dock";/** The dock's contents, reading the note out of the context the dock provides. */-function DockContent({ onClose }: { onClose(): void }) {+function DockContent({ note, parentNote, isEditable, onClose }: {+ note: FNote;+ parentNote: FNote;+ isEditable: boolean;+ onClose(): void;+}) {// The dock stands for its component in the DOM, which is how the text editor finds its host —// without this it resolves the widget enclosing the calendar instead (see the geo pane).const innerRef = useRef<HTMLDivElement>(null);@@ -95,6 +106,32 @@ function DockContent({ onClose }: { onClose(): void }) {</div><div className="calendar-detail-dock-body tn-embedded-note-pane">+ {/* What can be done with the event: the ways of opening its note (see+ OpenNoteActions), then the ways of changing it — left out rather than disabled+ where the calendar may not be edited, as the geo pane leaves them out. */}+ <EmbeddedNoteActions>+ <OpenNoteActions note={note} />++ {isEditable && <>+ {/* Named for the chip it dresses, the colour it sets being worn everywhere+ the note shows (see NoteColorPicker). */}+ <NoteColorAction note={note} title={t("calendar_view.event_color")} />++ <ActionButton+ className="tn-embedded-note-remove"+ icon="bx bx-trash"+ text={t("calendar_view.remove_from_calendar")}+ // Whether the note goes with its event is asked before anything+ // happens, the two being different wishes. Closed by hand where+ // something was done: unlike the geo pane, the dock has no effect+ // watching the note leave the calendar — a removed event is still a+ // note of the collection.+ onClick={() => void removeFromCalendar(note, parentNote)+ .then((removed) => removed && onClose())}+ />+ </>}+ </EmbeddedNoteActions>+<PromotedAttributes omit={EVENT_DATE_LABELS} /><NoteDetail /></div>diff --git a/apps/client/src/widgets/collections/calendar/api.ts b/apps/client/src/widgets/collections/calendar/api.tsindex b74f5047b6..ac602c17d7 100644--- a/apps/client/src/widgets/collections/calendar/api.ts+++ b/apps/client/src/widgets/collections/calendar/api.ts@@ -2,7 +2,10 @@ import { AttributeRow } from "@triliumnext/commons";import FNote from "../../../entities/fnote";import { setAttribute, setLabel } from "../../../services/attributes";+import dialog from "../../../services/dialog";+import { t } from "../../../services/i18n";import note_create from "../../../services/note_create";+import { deleteNoteOrBranch } from "../../../services/note_deletion";interface NewEventOpts {title: string;@@ -61,6 +64,47 @@ export async function newEvent(parentNote: FNote, { title, startDate, endDate, s}, componentId);}+/**+ * Takes an event off the calendar, having asked first, and offers to delete its note while it is at+ * it — the bargain the geo map strikes for a marker (see removeFromMap there): taking an event off+ * the calendar and getting rid of its note are different wishes, and granting only one of them left+ * a note behind that the calendar no longer showed. What deleting would actually cost is the+ * dialog's to work out and to say (see confirmDeleteNoteBoxWithNote); all this has to know is which+ * branch the calendar holds the note by.+ *+ * Answers whether anything was done, the caller's pane having nothing else to close itself by: an+ * event taken off the calendar is still a note of the collection, so no watcher of the collection's+ * notes will stand the pane down.+ */+export async function removeFromCalendar(note: FNote, calendarNote: FNote) {+ // The calendar's own branch for the note, which is how a note the calendar merely shows —+ // cloned in from elsewhere, and clone-able out again — is told from one that lives here and+ // nowhere else.+ const branchId = note.parentToBranch[calendarNote.noteId] ?? null;++ const result = await dialog.confirmDeleteNoteBoxWithNote(+ note.title,+ { noteId: note.noteId, branchId },+ { message: t("calendar_view.remove_from_calendar_confirmation", { title: note.title }) }+ );++ if (typeof result !== "object" || !result.confirmed) {+ return false;+ }++ if (result.isDeleteNoteChecked) {+ await deleteNoteOrBranch(note.noteId, branchId);+ } else {+ // Only the start date goes — the label the calendar draws the event by, which the note may+ // name for itself (see changeEvent). Whatever else the note holds about its dates keeps:+ // an end or a time without a start puts nothing on the calendar.+ const startAttribute = note.getLabelValue("calendar:startDate") || "startDate";+ await setAttribute(note, "label", startAttribute, undefined);+ }++ return true;+}+export async function changeEvent(note: FNote, { startDate, endDate, startTime, endTime, componentId }: ChangeEventOpts) {// Don't store the end date if it's empty.if (endDate === startDate) {diff --git a/apps/client/src/widgets/collections/calendar/index.tsx b/apps/client/src/widgets/collections/calendar/index.tsxindex 90cca62611..999fe9440b 100644--- a/apps/client/src/widgets/collections/calendar/index.tsx+++ b/apps/client/src/widgets/collections/calendar/index.tsx@@ -230,7 +230,12 @@ export default function CalendarView({ note, noteIds }: ViewModeProps<CalendarVi}}/></div>- <DetailDock noteId={selectedNoteId} onClose={() => setSelectedNoteId(null)} />+ <DetailDock+ noteId={selectedNoteId}+ parentNote={note}+ isEditable={isEditable}+ onClose={() => setSelectedNoteId(null)}+ /></div></div>);diff --git a/apps/client/src/widgets/collections/geomap/DetailPane.css b/apps/client/src/widgets/collections/geomap/DetailPane.cssindex 85637ab415..d4448e8600 100644--- a/apps/client/src/widgets/collections/geomap/DetailPane.css+++ b/apps/client/src/widgets/collections/geomap/DetailPane.css@@ -92,24 +92,3 @@}}-/*- * The ways of opening the note, at the head of the pane. Named by tooltips rather than labels, as- * every other row of actions in a panel is: labels would wrap four buttons onto two lines here.- */-.geo-map-container .geo-detail-pane .geo-detail-pane-actions {- display: flex;- align-items: center;- gap: 4px;-- /* Those that write rather than read stand apart from the ones being reached for repeatedly, so- the pointer cannot land on one of them by being a moment early. The gap falls before the first- of them, which is the colour: they are drawn together or not at all, a read-only map having- none of them. */- .geo-detail-pane-color {- margin-inline-start: auto;- }-}--:root .geo-map-container .geo-detail-pane .geo-detail-pane-remove.icon-action {- color: var(--dropdown-item-icon-destructive-color);-}diff --git a/apps/client/src/widgets/collections/geomap/DetailPane.spec.tsx b/apps/client/src/widgets/collections/geomap/DetailPane.spec.tsxindex 8ab900a1d7..c721f6d3bb 100644--- a/apps/client/src/widgets/collections/geomap/DetailPane.spec.tsx+++ b/apps/client/src/widgets/collections/geomap/DetailPane.spec.tsx@@ -15,7 +15,8 @@ import server from "../../../services/server";import { buildNote } from "../../../test/easy-froca";import { useLegacyImperativeHandlers, useNoteContext, useTriliumEvent } from "../../react/hooks";import { ParentComponent } from "../../react/react_utils";-import DetailPane, { OTHER_WAYS_TO_OPEN, PaneSelection } from "./DetailPane";+import { OTHER_WAYS_TO_OPEN } from "../../EmbeddedNotePane";+import DetailPane, { PaneSelection } from "./DetailPane";import { GPX_MIME, trackSourceId } from "./GpxTrack";import { ParentMap } from "./map";import { MARKER_LAYER } from "./Markers";@@ -596,7 +597,7 @@ describe("DetailPane", () => {}function press(icon: string) {- container?.querySelector<HTMLButtonElement>(`.geo-detail-pane-actions button.${icon}`)?.click();+ container?.querySelector<HTMLButtonElement>(`.tn-embedded-note-actions button.${icon}`)?.click();}it("opens the note where every note in Trilium is opened", async () => {@@ -642,7 +643,7 @@ describe("DetailPane", () => {const map = fakeMap();await openPaneFor(note, map);- expect(container?.querySelector(".geo-detail-pane-more")).toBeTruthy();+ expect(container?.querySelector(".tn-embedded-note-more")).toBeTruthy();expect(OTHER_WAYS_TO_OPEN.map((way) => way.command)).toEqual(linkContextMenu.getItems(new MouseEvent("click")).map((item) => ("command" in item ? item.command : undefined)));@@ -872,7 +873,7 @@ describe("DetailPane", () => {describe("moving the marker", () => {function moveButton() {- return container?.querySelector<HTMLButtonElement>(".geo-detail-pane-actions button.bx-move") ?? null;+ return container?.querySelector<HTMLButtonElement>(".tn-embedded-note-actions button.bx-move") ?? null;}/**@@ -927,14 +928,14 @@ describe("DetailPane", () => {// The rest of the row stands: only the one offer that cannot mean anything is gone.expect(pane()).toBeTruthy();- expect(container?.querySelector(".geo-detail-pane-actions button.bx-log-in")).toBeTruthy();+ expect(container?.querySelector(".tn-embedded-note-actions button.bx-log-in")).toBeTruthy();expect(moveButton()).toBeNull();});});describe("taking the marker off the map", () => {function removeButton() {- return container?.querySelector<HTMLButtonElement>(".geo-detail-pane-actions button.bx-trash") ?? null;+ return container?.querySelector<HTMLButtonElement>(".tn-embedded-note-actions button.bx-trash") ?? null;}/**@@ -995,7 +996,7 @@ describe("DetailPane", () => {// The ways of reading the note stay; the one that writes it does not.expect(pane()).toBeTruthy();- expect(container?.querySelector(".geo-detail-pane-actions button.bx-log-in")).toBeTruthy();+ expect(container?.querySelector(".tn-embedded-note-actions button.bx-log-in")).toBeTruthy();expect(removeButton()).toBeNull();});diff --git a/apps/client/src/widgets/collections/geomap/DetailPane.tsx b/apps/client/src/widgets/collections/geomap/DetailPane.tsxindex 04199c1d69..5406ebe87a 100644--- a/apps/client/src/widgets/collections/geomap/DetailPane.tsx+++ b/apps/client/src/widgets/collections/geomap/DetailPane.tsx@@ -4,21 +4,15 @@ import clsx from "clsx";import type { GeoJSONSource, MapGeoJSONFeature, Map as MapLibreGLMap, MapMouseEvent, MapSourceDataEvent } from "maplibre-gl";import { useCallback, useContext, useEffect, useMemo, useRef } from "preact/hooks";-import appContext from "../../../components/app_context";-import { openInCurrentNoteContext } from "../../../components/note_context";import FNote from "../../../entities/fnote";-import NoteColorPicker from "../../../menus/custom-items/NoteColorPicker";-import linkContextMenu from "../../../menus/link_context_menu";import { copyTextWithToast } from "../../../services/clipboard_ext";import { t } from "../../../services/i18n";import link from "../../../services/link";-import { announceEmbeddedNoteClosing, EmbeddedNoteScope, useEmbeddedNoteContext } from "../../EmbeddedNotePane";+import { announceEmbeddedNoteClosing, EmbeddedNoteActions, EmbeddedNoteScope, NoteColorAction, OpenNoteActions, useEmbeddedNoteContext } from "../../EmbeddedNotePane";import TitleRow from "../../layout/TitleRow";import NoteDetail from "../../NoteDetail";import PromotedAttributes from "../../PromotedAttributes";import ActionButton from "../../react/ActionButton";-import Dropdown from "../../react/Dropdown";-import { FormListItem } from "../../react/FormList";import { useLegacyComponentElement, useNoteColorClass, useNoteContext, useNoteLabel, useStaticTooltip } from "../../react/hooks";import OverlayPanel, { OverlayPanelBody } from "../../react/OverlayPanel";import { ParentComponent } from "../../react/react_utils";@@ -479,64 +473,16 @@ function MarkerDetails({ note, parentNote, isReadOnly, onClose, onRelocate, onFoconst PANE_NTX_ID = "_geo-detail-pane";/**- * What can be done with the marker: the ways of opening its note, then the ways of changing it.- *- * One way of opening it stands out — into the tab the map is in — and the rest are gathered behind- * the button beside it. Three of them spread across the row read as three unrelated things when they- * are one thing with three destinations, and the menu they are gathered into is the app's own, so- * the pane offers exactly what a link offers anywhere else rather than a hand-kept subset of it.- *- * The quick editor is in that menu but not in the row: it is what a click on a marker used to raise,- * and the pane took that click over — offering it here would put a modal back over the pane that- * replaced it.+ * What can be done with the marker: the ways of opening its note (see {@link OpenNoteActions}),+ * then the ways of changing it.*/function MarkerActions({ note, parentNote, isReadOnly, onRelocate }: { note: FNote; parentNote: FNote; isReadOnly: boolean; onRelocate(): void }) {const [ location ] = useNoteLabel(note, LOCATION_ATTRIBUTE);- const hoistedNoteId = appContext.tabManager.getActiveContext()?.hoistedNoteId;- // A path rather than an id: a note may hang in several places, and each of these opens a path.- const notePath = note.getBestNotePathString(hoistedNoteId);const latLng = parseLocation(location);return (- <div className="geo-detail-pane-actions">- <ActionButton- icon="bx bx-log-in"- text={t("geo-map.open-note")}- // Handed the event: `openInCurrentNoteContext` reads the target tab off the element- // clicked, which lands the note in the tab the map is in.- onClick={(e) => notePath && openInCurrentNoteContext(e as MouseEvent, notePath)}- disabled={!notePath}- />-- {/* The other ways of opening it, gathered behind one button rather than spread across- three: they are one act with three destinations.-- A dropdown and not the menu the marker's own right-click raises — that one is shown- at a point and dismissed by the next press on the document, and the press that opened- it from inside the panel is that press. */}- <Dropdown- className="geo-detail-pane-more"- buttonClassName="bx bx-dots-horizontal-rounded"- title={t("geo-map.more-ways-to-open")}- iconAction- hideToggleArrow- noDropdownListStyle- // The panel clips what overflows it, so a menu nested in the row would be cut off at- // its edge; and the panel's backdrop filter would flatten the menu's own.- portalToBody- disabled={!notePath}- >- {OTHER_WAYS_TO_OPEN.map(({ command, icon, title }) => (- <FormListItem- key={command}- icon={icon}- onClick={(e) => notePath && linkContextMenu.handleLinkContextMenuItem(- command, e as MouseEvent, notePath, {}, hoistedNoteId ?? null)}- >- {title()}- </FormListItem>- ))}- </Dropdown>+ <EmbeddedNoteActions>+ <OpenNoteActions note={note} /><ActionButtonicon="bx bx-map-alt"@@ -549,23 +495,9 @@ function MarkerActions({ note, parentNote, isReadOnly, onRelocate }: { note: FNo{/* Left out rather than disabled on a read-only map, as the right-click menu leaves themout: everything else in the row reads the note, these three alone write it. */}{!isReadOnly && <>- {/* The colour the pin is drawn in, which the pane already wears in its title but had- no way of setting — the right-click menu was the only place it could be reached.-- Sent to the body because the panel both clips what overflows it and carries a- backdrop filter, either of which would be enough to cut the menu off or flatten- its own frosting (see the Dropdown notes in CLAUDE.md). */}- <Dropdown- className="geo-detail-pane-color"- buttonClassName="bx bx-palette"- title={t("geo-map.marker-color")}- iconAction- hideToggleArrow- noDropdownListStyle- portalToBody- >- <NoteColorPicker note={note} />- </Dropdown>+ {/* Named for the pin it dresses, the colour it sets being worn everywhere the note+ shows (see NoteColorPicker). */}+ <NoteColorAction note={note} title={t("geo-map.marker-color")} />{/* A track is offered nothing here: it is on the map by being drawn across it, andits place is the line its file holds rather than a location that could be@@ -581,7 +513,7 @@ function MarkerActions({ note, parentNote, isReadOnly, onRelocate }: { note: FNo/>}<ActionButton- className="geo-detail-pane-remove"+ className="tn-embedded-note-remove"icon="bx bx-trash"// Named for what it does to a track, which is delete the note: a track's line is// drawn from the note's own file, so there is no taking it off the map and@@ -593,32 +525,10 @@ function MarkerActions({ note, parentNote, isReadOnly, onRelocate }: { note: FNoonClick={() => void removeFromMap(note, parentNote)}/></>}- </div>+ </EmbeddedNoteActions>);}-/**- * The ways of opening a note other than in the tab one is already in, which the split hides behind- * its arrow. The same four a link offers anywhere in the app, and each is carried out by the app's- * own handler — only the naming of them is repeated here.- *- * Repeated because `linkContextMenu.getItems` asks for the event that raised it, which a menu drawn- * before anything is pressed does not have. What it wants the event for is one mobile-only wording,- * so the loss is a label rather than behaviour. The titles are thunks so they are translated when- * the menu is drawn rather than when this module loads.- */-export const OTHER_WAYS_TO_OPEN = [- { command: "openNoteInNewTab", icon: "bx bx-link-external", title: () => t("link_context_menu.open_note_in_new_tab") },- // The one the row never offered, and the one a map most wants: the place stays on show while the- // note is read beside it.- { command: "openNoteInNewSplit", icon: "bx bx-dock-right", title: () => t("link_context_menu.open_note_in_new_split") },- { command: "openNoteInNewWindow", icon: "bx bx-window-open", title: () => t("link_context_menu.open_note_in_new_window") },- // The quick editor, which is what a marker click used to raise before the pane took that click- // over. Kept because the marker's own right-click menu offers it and the two should agree —- // it is a way of opening the note that happens to stand over the pane, not a rival to it.- { command: "openNoteInPopup", icon: "bx bx-edit", title: () => t("link_context_menu.open_note_in_popup") }-] as const;-/*** Where the marker stands, written out under the note's name.*