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/breadcrumb: tweak the dropdowns
Adorian Doranb454af395217
diff --git a/apps/client/src/widgets/layout/Breadcrumb.css b/apps/client/src/widgets/layout/Breadcrumb.cssindex 7531160c71..71d142cffe 100644--- a/apps/client/src/widgets/layout/Breadcrumb.css+++ b/apps/client/src/widgets/layout/Breadcrumb.css@@ -115,6 +115,15 @@}.breadcrumb-child-list {+ max-width: 500px;++ .dropdown-item > span > :last-child {+ min-width: 0;+ overflow: hidden;+ white-space: nowrap;+ text-overflow: ellipsis;+ }+.protected-title {font-style: italic;}diff --git a/apps/client/src/widgets/layout/Breadcrumb.spec.tsx b/apps/client/src/widgets/layout/Breadcrumb.spec.tsxindex 80a0788f14..d791e68df5 100644--- a/apps/client/src/widgets/layout/Breadcrumb.spec.tsx+++ b/apps/client/src/widgets/layout/Breadcrumb.spec.tsx@@ -1,10 +1,12 @@import { act } from "preact/test-utils";import { afterEach, describe, expect, it, vi } from "vitest";+import type NoteContext from "../../components/note_context";+import type { MenuCommandItem } from "../../menus/context_menu";import protectedSessionHolder from "../../services/protected_session_holder";import { buildNote } from "../../test/easy-froca";import { renderInto } from "../../test/render";-import { BreadcrumbNoteTitle } from "./Breadcrumb";+import { BreadcrumbNoteTitle, buildChildNoteItems, noteTitleHtml } from "./Breadcrumb";vi.mock("../../services/i18n", async (importOriginal) => ({...(await importOriginal<typeof import("../../services/i18n")>()),@@ -47,3 +49,57 @@ describe("BreadcrumbNoteTitle", () => {expect(renderTitle(false, false)?.querySelector(".protected-icon")).toBeNull();});});++describe("noteTitleHtml", () => {+ afterEach(() => {+ vi.restoreAllMocks();+ });++ it("escapes the title, and reads Protected with a lock while the session is locked", () => {+ const note = buildNote({ title: "R&D <b>" });+ expect(noteTitleHtml(note)).toBe("R&D <b>");++ note.isProtected = true;+ const lock = `<span class="bx bx-lock-alt protected-icon tn-icon"></span>`;+ vi.spyOn(protectedSessionHolder, "isProtectedSessionAvailable").mockReturnValue(true);+ expect(noteTitleHtml(note)).toBe(`R&D <b>${lock}`);+ vi.spyOn(protectedSessionHolder, "isProtectedSessionAvailable").mockReturnValue(false);+ const locked = `<span class="protected-title">protected_session.locked_note_title</span>`;+ expect(noteTitleHtml(note)).toBe(`${locked}${lock}`);+ });+});++describe("buildChildNoteItems", () => {+ const children = () => [+ buildNote({ id: "_hidden", title: "Hidden" }),+ buildNote({ id: "rnd", title: "R&D" }),+ buildNote({ id: "old", title: "Old", "#archived": "" })+ ];+ const titles = (items: ReturnType<typeof buildChildNoteItems>) =>+ items.map((item) => ("title" in item ? item.title : item.kind));++ it("lists the children in order, the one on the path in bold, then a create row", () => {+ const setNote = vi.fn();+ const noteContext = { setNote } as unknown as NoteContext;+ const items = buildChildNoteItems(children(), {+ notePath: "root/parent", activeNotePath: "root/parent/rnd",+ noteContext, hideArchivedNotes: false+ });+ expect(titles(items)).toEqual([+ "<strong>R&D</strong>", "Old", "separator", "breadcrumb.create_new_note"+ ]);+ expect(items[1]).toMatchObject({ className: "archived" });++ const first = items[0] as MenuCommandItem<unknown>;+ first.handler?.(first, new MouseEvent("click"));+ expect(setNote).toHaveBeenCalledWith("root/parent/rnd");+ });++ it("leaves out hidden archived notes, and the separator once no child is left", () => {+ const props = { notePath: "root/parent", noteContext: undefined, hideArchivedNotes: true };+ expect(titles(buildChildNoteItems(children(), props)))+ .toEqual([ "R&D", "separator", "breadcrumb.create_new_note" ]);+ expect(titles(buildChildNoteItems(children().slice(2), props)))+ .toEqual([ "breadcrumb.create_new_note" ]);+ });+});diff --git a/apps/client/src/widgets/layout/Breadcrumb.tsx b/apps/client/src/widgets/layout/Breadcrumb.tsxindex 9b44aa4ccd..4aed864f7c 100644--- a/apps/client/src/widgets/layout/Breadcrumb.tsx+++ b/apps/client/src/widgets/layout/Breadcrumb.tsx@@ -22,12 +22,14 @@ import { t } from "../../services/i18n";import note_create from "../../services/note_create";import options from "../../services/options";import tree from "../../services/tree";+import { escapeHtml } from "../../services/utils";import ActionButton from "../react/ActionButton";import { Badge } from "../react/Badge";import Dropdown from "../react/Dropdown";-import { FormDropdownDivider, FormListItem } from "../react/FormList";+import { FormListItem } from "../react/FormList";import { useActiveNoteContext, useChildNotes, useNote, useNoteColorClass, useNoteIcon, useNoteLabel, useNoteLabelBoolean, useNoteTitle, useStaticTooltip, useTriliumOptionBool } from "../react/hooks";import Icon from "../react/Icon";+import { MenuItemRows } from "../react/Menu";import { NewNoteLink } from "../react/NoteLink";import { ParentComponent } from "../react/react_utils";@@ -205,44 +207,57 @@ function BreadcrumbSeparator(props: BreadcrumbSeparatorProps) {hideToggleArrowdropdownContainerClassName="breadcrumb-child-list"placement="top"+ filterable+ keepOrder><BreadcrumbSeparatorDropdownContent {...props} /></Dropdown>);}-function BreadcrumbSeparatorDropdownContent({ notePath, noteContext, activeNotePath, hideArchivedNotes }: BreadcrumbSeparatorProps) {- const notePathComponents = (notePath ?? "").split("/");- const parentNoteId = notePathComponents.at(-1);+function BreadcrumbSeparatorDropdownContent(props: BreadcrumbSeparatorProps) {+ const parentNoteId = (props.notePath ?? "").split("/").at(-1);const childNotes = useChildNotes(parentNoteId);+ return <MenuItemRows items={buildChildNoteItems(childNotes, props)} />;+}- return (- <>- {childNotes.map((note) => {- if (note.noteId === "_hidden") return;- if (hideArchivedNotes && note.isArchived) return null;+/** The rows of a separator's menu: the children of the note before it, then "Create new note". */+export function buildChildNoteItems(childNotes: FNote[], props: BreadcrumbSeparatorProps) {+ const { notePath, activeNotePath, noteContext, hideArchivedNotes } = props;+ const items: MenuItem<unknown>[] = [];+ for (const note of childNotes) {+ if (note.noteId === "_hidden") continue;+ if (hideArchivedNotes && note.isArchived) continue;++ const childNotePath = `${notePath}/${note.noteId}`;+ const title = noteTitleHtml(note);+ items.push({+ title: childNotePath === activeNotePath ? `<strong>${title}</strong>` : title,+ uiIcon: note.getIcon(),+ iconColorClass: note.getColorClass(),+ className: note.isArchived ? "archived" : undefined,+ handler: () => noteContext?.setNote(childNotePath)+ });+ }- const childNotePath = `${notePath}/${note.noteId}`;- return <li key={note.noteId}>- <FormListItem- icon={note.getIcon()}- className={clsx(note.getColorClass(), note.isArchived && "archived")}- onClick={() => noteContext?.setNote(childNotePath)}- >- {childNotePath !== activeNotePath- ? <span><BreadcrumbNoteTitle note={note} /></span>- : <strong><BreadcrumbNoteTitle note={note} /></strong>}- </FormListItem>- </li>;- })}+ if (items.length > 0) items.push({ kind: "separator" });+ items.push({+ title: t("breadcrumb.create_new_note"),+ uiIcon: "bx bx-plus",+ handler: () => note_create.createNote(notePath, { activate: true })+ });+ return items;+}- {childNotes.length > 0 && <FormDropdownDivider />}- <FormListItem- icon="bx bx-plus"- onClick={() => note_create.createNote(notePath, { activate: true })}- >{t("breadcrumb.create_new_note")}</FormListItem>- </>- );+/** The HTML of {@link BreadcrumbNoteTitle}, for a menu item's title. */+export function noteTitleHtml(note: FNote) {+ const locked = escapeHtml(t("protected_session.locked_note_title"));+ const title = note.isContentAvailable()+ ? escapeHtml(note.title)+ : `<span class="protected-title">${locked}</span>`;+ return note.isProtected+ ? `${title}<span class="bx bx-lock-alt protected-icon tn-icon"></span>`+ : title;}function BreadcrumbCollapsed({ items, noteContext }: {diff --git a/apps/client/src/widgets/react/Dropdown.tsx b/apps/client/src/widgets/react/Dropdown.tsxindex 3c406c7b07..11c94bd18d 100644--- a/apps/client/src/widgets/react/Dropdown.tsx+++ b/apps/client/src/widgets/react/Dropdown.tsx@@ -27,8 +27,13 @@ export interface DropdownProps extends Pick<HTMLAttributes<HTMLDivElement>, "id"* `handler`, then closes the menu.*/items?: MenuItem<unknown>[];- /** For a {@link Dropdown} of {@link items}, offers an input at its top that filters them. */+ /**+ * For a {@link Dropdown} of {@link items}, or of children whose rows `MenuItemRows` draws,+ * offers an input at its top that filters them.+ */filterable?: boolean;+ /** For a {@link filterable} menu above its toggle, keeps the rows in their own order. */+ keepOrder?: boolean;title?: string;dropdownContainerStyle?: CSSProperties;dropdownContainerClassName?: string;@@ -110,6 +115,7 @@ export default function Dropdown(props: DropdownProps) {isWanted={isWanted}items={props.items}filterable={props.filterable}+ keepOrder={props.keepOrder}onSelect={(item, e) => {item.handler?.(item, e);if (!item.items) close();diff --git a/apps/client/src/widgets/react/Menu.spec.tsx b/apps/client/src/widgets/react/Menu.spec.tsxindex 5233e08c9a..a9d80cfe3c 100644--- a/apps/client/src/widgets/react/Menu.spec.tsx+++ b/apps/client/src/widgets/react/Menu.spec.tsx@@ -1,11 +1,12 @@import { Tooltip } from "bootstrap";import { render } from "preact";+import { useState } from "preact/hooks";import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";import type { MenuItem } from "../../menus/context_menu";import { formatShortcut, joinShortcut } from "../../services/keyboard_shortcut_display";import { FormDropdownDivider, FormDropdownSubmenu, FormListHeader, FormListItem } from "./FormList";-import Menu, { bottomUpOrder, type MenuProps } from "./Menu";+import Menu, { bottomUpOrder, MenuItemRows, type MenuProps } from "./Menu";import { shouldDropStart } from "./menu_context";vi.mock("../../services/keyboard_actions", async (importOriginal) => {@@ -581,4 +582,52 @@ describe("Menu of items above its anchor", () => {window.dispatchEvent(new Event("resize"));await vi.waitFor(() => expect(menu.style.top).toBe("610px"));});++ it("filters the rows MenuItemRows draws, bottom-up, once they load", async () => {+ const items: MenuItem<unknown>[] = [+ { title: "Python" }, { title: "JavaScript" }, { kind: "separator" }, { title: "New" }+ ];+ let load = () => {};+ function LoadedRows() {+ const [ isLoaded, setIsLoaded ] = useState(false);+ load = () => setIsLoaded(true);+ return isLoaded ? <MenuItemRows items={items} /> : null;+ }+ const menu = await openAt(700, {+ filterable: true, placement: "top", children: <LoadedRows />+ });+ const box = menu.querySelector(":scope > .tn-menu-filterable");+ const list = () => box?.querySelector(":scope > .tn-menu-scroll");+ expect(classesOf(box)).toEqual([ "tn-menu-scroll", "tn-menu-filter" ]);+ expect(activeRow(menu)).toBeUndefined();++ load();+ await vi.waitFor(() => expect(rowsOf(list()))+ .toEqual([ "New", "---", "JavaScript", "Python" ]));+ await vi.waitFor(() => expect(activeRow(menu)).toBe("Python"));++ key(menu, "j");+ await vi.waitFor(() => expect(rowsOf(list())).toEqual([ "JavaScript" ]));+ expect(activeRow(menu)).toBe("JavaScript");+ });++ it("keeps the order of its rows with keepOrder, the best match first", async () => {+ const menu = await openAt(700, { filterable: true, keepOrder: true, items: [+ { title: "Python" }, { title: "JavaScript" }, { title: "Plain text" },+ { kind: "separator" }, { title: "Markdown" }+ ] });+ const box = menu.querySelector(":scope > .tn-menu-filterable");+ const list = () => box?.querySelector(":scope > .tn-menu-scroll");+ // The input stays next to the toggle.+ expect(classesOf(box)).toEqual([ "tn-menu-scroll", "tn-menu-filter" ]);+ expect(rowsOf(list())).toEqual([ "Python", "JavaScript", "Plain text", "---", "Markdown" ]);+ expect(activeRow(menu)).toBeUndefined();++ key(menu, "p");+ await vi.waitFor(() => expect(rowsOf(list()))+ .toEqual([ "Python", "Plain text", "JavaScript" ]));+ expect(activeRow(menu)).toBe("Python");+ key(menu, "ArrowDown");+ await vi.waitFor(() => expect(activeRow(menu)).toBe("Plain text"));+ });});diff --git a/apps/client/src/widgets/react/Menu.tsx b/apps/client/src/widgets/react/Menu.tsxindex 3b2fa64374..1e715caf71 100644--- a/apps/client/src/widgets/react/Menu.tsx+++ b/apps/client/src/widgets/react/Menu.tsx@@ -53,11 +53,17 @@ export interface MenuProps<T> extends Pick<PopupProps, "anchor" | "offset" | "coisWanted?(): boolean;items?: MenuItem<T>[];/**- * For a menu of {@link items}: offers an input at its top that filters every item, at any depth,- * as `MenuCommandItem.filterable` does for a submenu. Placed above its anchor, the menu is- * drawn bottom-up: the input at the bottom, and the first row lowest and active as it opens.+ * For a menu of {@link items}, or of components whose rows `MenuItemRows` draws: offers an+ * input at its top that filters every item, at any depth, as `MenuCommandItem.filterable` does+ * for a submenu. Placed above its anchor, the menu is drawn bottom-up: the input at the bottom,+ * and the first row lowest and active as it opens.*/filterable?: boolean;+ /**+ * For a {@link filterable} menu placed above its anchor: keeps the input at the bottom, but+ * draws the rows in their own order, the first one at the top, as in the note tree.+ */+ keepOrder?: boolean;/** Called when one of {@link items} is pressed with the primary button, or run from the keyboard. */onSelect?(item: MenuCommandItem<T>, e: MouseEvent | KeyboardEvent): void;children?: ComponentChildren;@@ -82,7 +88,7 @@ const ACTION_TOOLTIP = { placement: "top", animation: false } as const;/** How long typed letters keep adding to the text a row is looked up by. */const TYPEAHEAD_TIMEOUT = 500;-export default function Menu<T>({ id, className, anchor, placement, bottomSheet, inline, startAt, items, filterable, onSelect, children, onClose, onDismiss, isWanted, elementRef, ...popupProps }: MenuProps<T>) {+export default function Menu<T>({ id, className, anchor, placement, bottomSheet, inline, startAt, items, filterable, keepOrder, onSelect, children, onClose, onDismiss, isWanted, elementRef, ...popupProps }: MenuProps<T>) {const menuRef = useRef<HTMLDivElement | null>(null);// The submenus' layers render into the menu element, which rows reach through the context.const [ layerHost, setLayerHost ] = useState<HTMLElement | null>(null);@@ -128,6 +134,8 @@ export default function Menu<T>({ id, className, anchor, placement, bottomSheet,/** The placement above its anchor of a filterable menu, which is then drawn bottom-up. */const [ upwardPlacement, setUpwardPlacement ] = useState<Placement>();const bottomUp = !!upwardPlacement;+ /** Whether the top level's rows are drawn in reverse, the first row lowest. */+ const isReversed = bottomUp && !keepOrder;/** Whether the menu has asked to close, which it does once. */const closed = useRef(false);const close = useCallback(() => {@@ -160,7 +168,7 @@ export default function Menu<T>({ id, className, anchor, placement, bottomSheet,});}, [ rows ]);const context: MenuContextValue = {- open, openSubmenu, active, setActive, rows, registerRow, keyboardDriven, dropStart, setDropStart, close, filter, setFilter, layerHost+ open, openSubmenu, active, setActive, rows, registerRow, keyboardDriven, isReversed, dropStart, setDropStart, close, filter, setFilter, layerHost};/** The ids of the rows the keys can stand on at `level`, in the order they stand in. */@@ -176,11 +184,11 @@ export default function Menu<T>({ id, className, anchor, placement, bottomSheet,/*** Makes the first row at `level` that runs something the active one, if the level has rendered.- * The first row of a bottom-up menu is the lowest one.+ * The first row of a reversed menu is the lowest one.*/function activateFirstRow(level: number) {const runnable = navigableRows(level).filter((rowId) => !rows.get(rowId)?.custom);- const first = level === 0 && bottomUp ? runnable.at(-1) : runnable[0];+ const first = level === 0 && isReversed ? runnable.at(-1) : runnable[0];if (first) setActive(level, first);return !!first;}@@ -213,7 +221,9 @@ export default function Menu<T>({ id, className, anchor, placement, bottomSheet,const level = (filter ?? lastFilter.current)?.level;lastFilter.current = filter;if (level === undefined) return;- if (!activateFirstRow(level + 1)) pendingFirstRow.current = level + 1;+ // Rows that `MenuItemRows` draws in a component of its own render after this effect.+ activateFirstRow(level + 1);+ pendingFirstRow.current = level + 1;// Typing into the input moves the active row, as the keys do.if (filter) setKeyboardDriven(true);@@ -376,7 +386,7 @@ export default function Menu<T>({ id, className, anchor, placement, bottomSheet,const rowId = open[parent]?.id;if (rowId && rows.get(rowId)?.filterable) target = { rowId, level: parent };}- if (!target && filterable && items) target = TOP_LEVEL;+ if (!target && filterable) target = TOP_LEVEL;if (!target) return false;// The submenus open inside it give way to the list of matches.openSubmenu(target.level + 1);@@ -391,15 +401,18 @@ export default function Menu<T>({ id, className, anchor, placement, bottomSheet,// A menu already closing, as one whose row ran before it was placed, leaves focus alone.if (closed.current || isWanted?.() === false) return;menuRef.current?.focus({ preventScroll: true });- if (!startAt && !isBottomUp) return;+ const isLowestFirst = isBottomUp && !keepOrder;+ if (!startAt && !isLowestFirst) return;const rowIds = navigableRows(0);- // A bottom-up menu starts at its lowest row, however it was opened.- const first = startAt === "first" && !isBottomUp ? rowIds[0] : rowIds.at(-1);+ // A reversed menu starts at its lowest row, however it was opened.+ const first = startAt === "first" && !isLowestFirst ? rowIds[0] : rowIds.at(-1);if (first) setActive(0, first);+ // Rows that are still loading get the first row once they render.+ else if (isLowestFirst || startAt === "first") pendingFirstRow.current = 0;setKeyboardDriven(true);}- const topLevelFilter = items && filterable+ const topLevelFilter = filterable? { ...TOP_LEVEL, text: filter?.level === TOP_LEVEL.level ? filter.text : "" }: undefined;const defaultPlacement = anchor instanceof HTMLElement ? "bottom-start" : "right-start";@@ -450,7 +463,7 @@ export default function Menu<T>({ id, className, anchor, placement, bottomSheet,><MenuList filter={topLevelFilter} bottomUp={bottomUp}>{items- ? <MenuItems items={items} bottomUp={bottomUp} onSelect={onSelect} />+ ? <MenuItems items={items} bottomUp={isReversed} onSelect={onSelect} />: children}</MenuList>{/* The submenus' layers follow the scroller in here, portaled by their rows. */}@@ -466,11 +479,15 @@ export default function Menu<T>({ id, className, anchor, placement, bottomSheet,*/export function MenuItemRows<T>({ items }: { items: MenuItem<T>[] }) {const menu = useContext(MenuContext);+ const level = useContext(MenuLevelContext);return (- <MenuItems items={items} onSelect={(item, e) => {- item.handler?.(item, e);- if (!item.items) menu?.close();- }} />+ <MenuItems+ items={items} bottomUp={level === 0 && !!menu?.isReversed}+ onSelect={(item, e) => {+ item.handler?.(item, e);+ if (!item.items) menu?.close();+ }}+ />);}diff --git a/apps/client/src/widgets/react/menu_context.ts b/apps/client/src/widgets/react/menu_context.tsindex 37484c1810..c121156924 100644--- a/apps/client/src/widgets/react/menu_context.ts+++ b/apps/client/src/widgets/react/menu_context.ts@@ -71,6 +71,8 @@ export interface MenuContextValue {registerRow(id: string, row: RowEntry | undefined): void;/** Whether the keys moved the menu since the pointer last did. */keyboardDriven: boolean;+ /** Whether the top level's rows are drawn in reverse, the first row lowest. */+ isReversed: boolean;/*** Whether the submenus of each level's rows open towards the start, indexed by level. Only the* placement follows it; a row's arrow points to the end, as in the operating system's menus.diff --git a/apps/server/src/assets/help/help_content.json b/apps/server/src/assets/help/help_content.jsonindex 7c9019c79a..424844c24a 100644--- a/apps/server/src/assets/help/help_content.json+++ b/apps/server/src/assets/help/help_content.json@@ -60,7 +60,7 @@"_help_t596jLvPrqkS": "<p>Some note types (such as <a class=\"reference-link\" href=\"#root/_help_iPIMuisry3hd\">Text</a> and saved search) intentionally limit the width of the content.</p><p>This might appear surprising at first, but the idea is to make text fit well on wider screens without appearing distorted. This is especially the case if the document contains <a class=\"reference-link\" href=\"#root/_help_mT0HEkOsz6i1\">Images</a>, tables or other width-dependent elements.</p><h2>Configuring the content width and alignment</h2><p>The content width is expressed in pixels and can be changed from <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> → <em>Appearance</em> → <em>Content Width</em> and adjusting the <em>Max content width</em> section.</p><p>To effectively disable the content width limitation, simply set the width to a value larger than your screen size (e.g. 9999).</p><p>By default, the content is aligned to the left, but it can be centered horizontally by checking <em>Keep content centered</em> from the same section as the content width.</p><h2>Adjusting at note level</h2><p>For notes with large elements such as <a class=\"reference-link\" href=\"#root/_help_NdowYOC1GFKS\">Tables</a>, it sometimes makes sense to avoid the content width without affecting other notes. To do so:</p><ul><li>Go to <a class=\"reference-link\" href=\"#root/_help_8YBEPzcpUgxw\">Note menu</a> and toggle <em>Full width</em>.</li><li>Or manually apply the <code>fullContentWidth</code> <a href=\"#root/_help_HI6GBBIduIgv\">label</a> to the note.</li></ul><p>Since v0.107.0, a single table can also be made wider than the content width, in which case it scrolls sideways. See <a class=\"reference-link\" href=\"#root/_help_NdowYOC1GFKS\">Tables</a>.</p><aside class=\"admonition note\"><p>Some <a href=\"#root/_help_KSZ04uQ2D1St\">note types</a> are full width by default, such as the <a class=\"reference-link\" href=\"#root/_help_grjYqerjn243\">Canvas</a>. In that case the <em>Full width</em> toggle will not be displayed and the label will have no effect.</p></aside><h2>Shared notes</h2><p>On a <a href=\"#root/_help_R9pX4DGra2Vt\">shared page</a>, a text note is shown at a fixed reading width, whatever the width configured in Options, and the navigation tree, the content and the table of contents are kept together in a column centered on a wide screen. A note with <code>fullContentWidth</code>, or of a type that is full width in the application, uses the whole width of the window there, with the navigation tree and the table of contents at its edges.</p>","_help_jcQVxzYybYgz": "<figure class=\"image image-style-align-right image_resized\" style=\"width:44.65%;\"><img style=\"aspect-ratio:514/291;\" src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/UI%20Elements/Note%20contextual%20menu_image.png\" width=\"514\" height=\"291\"></figure><p>Right-clicking the content of some note types such as <a class=\"reference-link\" href=\"#root/_help_iPIMuisry3hd\">Text</a> or <a class=\"reference-link\" href=\"#root/_help_6f9hih2hXXZk\">Code</a> reveals a contextual menu.</p><h2>Features</h2><ul><li>On the <a class=\"reference-link\" href=\"#root/_help_poXkQfguuA0U\">Desktop Installation</a>, the <a class=\"reference-link\" href=\"#root/_help_oBo3iHIZnbG2\">Spell Check</a> suggestions are shown when right clicking on a misspelled word.</li><li>The selected text can be searched either with a search engine (configured from <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a>) or <a href=\"#root/_help_eIg8jdvaoNNd\">inside Trilium</a>.</li><li>Basic clipboard functionality (cut, copy, paste).</li><li>Copying the selected text as <a class=\"reference-link\" href=\"#root/_help_Oau6X9rCuegd\">Markdown</a>.</li><li>Performing quick operations using the <a class=\"reference-link\" href=\"#root/_help_VRoP0g1uHHc2\">In-editor AI assistant</a>.</li></ul><h2>Differences between desktop and web</h2><p>The <a href=\"#root/_help_WOcw2SLH6tbX\">web version</a> behaves slightly different due to limitations imposed by web browsers:</p><ul><li>When no text is selected or a word is right-clicked, the browser's default contextual menu is displayed.<ul><li>This is intentional since it preserves the <a class=\"reference-link\" href=\"#root/_help_oBo3iHIZnbG2\">Spell Check</a> functionality.</li></ul></li><li>When a text is selected, a reduced menu is displayed instead which features only the functionality that is available within the browser version<ul><li><em>Paste</em> is not available since the browser doesn't expose it, use <kbd>Ctrl</kbd>+<kbd>V</kbd> instead.</li><li>The browser menu can be triggered anyway by pressing <kbd>Shift</kbd> + <kbd>Right click</kbd>.</li></ul></li></ul>","_help_AlJ73vBCjWDw": "<p>The status bar displays information about the current note and allows changing settings related to it such as configuring the language or attributes.</p><h2>Layout and interaction</h2><p>On the left side, the <a class=\"reference-link\" href=\"#root/_help_I6p2a06hdnL6\">Breadcrumb</a> is displayed which indicates the current note as well as its parent notes and allows for quick navigation throughout the hierarchy.</p><p>On the right side, specific sections will show depending on the type of the current note.</p><ol><li>For <a class=\"reference-link\" href=\"#root/_help_6f9hih2hXXZk\">Code</a> notes, the language mode of the note is indicated (e.g. JavaScript, plain text), as well as allowing easy switching to another mode.<ol><li>Before it, the position of the cursor is shown as a line and a column, such as <em>Ln: 12 Col: 32</em>. It updates as the cursor moves. While text is selected, the number of selected characters follows, such as <em>Selected: 120</em>.</li></ol></li><li>For <a class=\"reference-link\" href=\"#root/_help_iPIMuisry3hd\">Text</a> notes, the content language is displayed and can be changed, thus configuring the spell-check and the right-to-left support.<ol><li>Note that this applies to the entire note and not the selection, unlike some text editors.</li></ol></li><li>If a note is placed in multiple places in the tree (cloned), the number of the note paths will be displayed.<ol><li>Clicking it opens a popup with the full list of note paths, from which the note can also be cloned to a new location. The same list is available in the sidebar's <a class=\"reference-link\" href=\"#root/_help_KRlZFoIH0j6p\">Connections tab</a>.</li></ol></li><li>If a note has attachments, their number will be displayed.<ol><li>Clicking on it will reveal the list of attachments in a new tab.</li></ol></li><li>If a note is linked from other text notes (backlinks), the number of backlinks will be displayed.<ol><li>Clicking on it opens a popup with the list of notes that link to this note, as well as an excerpt of where the note is referenced. The same list is available in the sidebar's <a class=\"reference-link\" href=\"#root/_help_KRlZFoIH0j6p\">Connections tab</a>.</li></ol></li></ol><p>Regardless of note type, the following items will always be displayed if there is a note:</p><ol><li>Note info, which displays:<ol><li>The creation/modification date of the note.</li><li>The type and MIME of the note.</li><li>The note ID.</li><li>An estimation of the note size of the note itself and its children.</li><li>A button to reveal the Similar notes in the sidebar's <a class=\"reference-link\" href=\"#root/_help_KRlZFoIH0j6p\">Connections tab</a>.</li></ol></li></ol><aside class=\"admonition note\"><p>When pressing a button which reveals the <a class=\"reference-link\" href=\"#root/_help_RnaPdbciOfeq\">Right Sidebar</a>, it has a specific behavior if the sidebar is hidden: the sidebar will be peeked instead of docked. Regardless the sidebar will be switched to the appropriate tab and the corresponding section will be highlighted.</p></aside>",- "_help_I6p2a06hdnL6": "<figure class=\"image\"><img style=\"aspect-ratio:1150/27;\" src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/UI%20Elements/Breadcrumb_image.png\" width=\"1150\" height=\"27\"></figure><p>The breadcrumb allows quickly viewing the note hierarchy of the current note and navigating through it.</p><p>It is part of the <a class=\"reference-link\" href=\"#root/_help_AlJ73vBCjWDw\">Status bar</a>, displayed in the bottom-left of the screen.</p><h2>Layout and Interaction</h2><ul><li>If a note or workspace is hoisted, a badge will appear on the left-most side.<ul><li>Clicking on the badge will un-hoist the note/workspace.</li></ul></li><li>The left-most icon represents the root note, or the hoisted note or workspace.<ul><li>Clicking the icon will jump to the root note.</li><li>Right clicking the icon will display a menu that allows opening the note in a new tab, split, etc.</li></ul></li><li>Each segment shows the title of a note in the current note hierarchy.<ul><li>Clicking the icon will jump to that note.</li><li>Right clicking will open a menu with multiple options such as opening the note in a different tab/split/window, hoisting, moving/cloning the note, duplicating as well as changing the color of the note.</li></ul></li><li>Clicking the arrow next to each segment will reveal the child notes of the segment on the left.<ul><li>Clicking on an icon will navigate to that particular note.</li><li>It's also possible to create a new child note from here.</li><li>The menu can optionally hide the archived notes.</li></ul></li><li>If the current note is deep within a hierarchy, the segments will collapse into a […] button in order not to occupy too much space.<ul><li>Clicking this button will display each collapsed entry as a menu item. Clicking on it will navigate to that particular note.</li></ul></li><li>Right clicking on an empty space to the right of the breadcrumb (before the other status bar items) will reveal another menu that allows:<ul><li>Toggling whether archived notes are displayed in the breadcrumb and in the note tree.</li><li>Copying the current note path to clipboard.</li></ul></li></ul>",+ "_help_I6p2a06hdnL6": "<figure class=\"image\"><img style=\"aspect-ratio:1150/27;\" src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/UI%20Elements/Breadcrumb_image.png\" width=\"1150\" height=\"27\"></figure><p>The breadcrumb allows quickly viewing the note hierarchy of the current note and navigating through it.</p><p>It is part of the <a class=\"reference-link\" href=\"#root/_help_AlJ73vBCjWDw\">Status bar</a>, displayed in the bottom-left of the screen.</p><h2>Layout and Interaction</h2><ul><li>If a note or workspace is hoisted, a badge will appear on the left-most side.<ul><li>Clicking on the badge will un-hoist the note/workspace.</li></ul></li><li>The left-most icon represents the root note, or the hoisted note or workspace.<ul><li>Clicking the icon will jump to the root note.</li><li>Right clicking the icon will display a menu that allows opening the note in a new tab, split, etc.</li></ul></li><li>Each segment shows the title of a note in the current note hierarchy.<ul><li>Clicking the icon will jump to that note.</li><li>Right clicking will open a menu with multiple options such as opening the note in a different tab/split/window, hoisting, moving/cloning the note, duplicating as well as changing the color of the note.</li></ul></li><li>Clicking the arrow next to each segment will reveal the child notes of the segment on the left.<ul><li>Clicking on an icon will navigate to that particular note.</li><li>To find a child note by its title, start typing: the field at the bottom of the menu filters the list.</li><li>It's also possible to create a new child note from here.</li><li>The menu can optionally hide the archived notes.</li></ul></li><li>If the current note is deep within a hierarchy, the segments will collapse into a […] button in order not to occupy too much space.<ul><li>Clicking this button will display each collapsed entry as a menu item. Clicking on it will navigate to that particular note.</li></ul></li><li>Right clicking on an empty space to the right of the breadcrumb (before the other status bar items) will reveal another menu that allows:<ul><li>Toggling whether archived notes are displayed in the breadcrumb and in the note tree.</li><li>Copying the current note path to clipboard.</li></ul></li></ul>","_help_BFs8mudNFgCS": "<p>Note is a central entity in Trilium. Main attributes of note are <a href=\"#root/_help_l7pigIGu01K2\">title</a> and content.</p><h3>Note types</h3><p>The main note type is a rich-text note type called <a class=\"reference-link\" href=\"#root/_help_iPIMuisry3hd\">Text</a>. For diagrams and drawing there is <a class=\"reference-link\" href=\"#root/_help_grjYqerjn243\">Canvas</a> and <a class=\"reference-link\" href=\"#root/_help_s1aBHPd79XYj\">Mermaid Diagrams</a>.</p><p>There are also more complex note types such as <a class=\"reference-link\" href=\"#root/_help_m523cpzocqaD\">Saved Search</a>, <a class=\"reference-link\" href=\"#root/_help_HcABDtFCkbFN\">Render Note</a> that usually go hand-in-hand with <a class=\"reference-link\" href=\"#root/_help_CdNpE2pqjmI6\">Scripting</a>.</p><p>In Trilium there's no specific \"folder\" note type. Any note can have children and thus be a folder. To make a note that only shows its children, like a folder in other applications, use a <a class=\"reference-link\" href=\"#root/_help_8QqnMzx393bx\">Grid View</a> or <a class=\"reference-link\" href=\"#root/_help_mULW0Q3VojwY\">List View</a> collection. See also <a class=\"reference-link\" href=\"#root/_help_i6dbnitykE5D\">FAQ</a>.</p><h3>Root note</h3><p>There's one special note called \"root note\" which is root of the note tree. All other notes are placed below it in the structure.</p><h3>Tree structure</h3><p>Importantly, note itself doesn't carry information on its placement in note tree. See <a class=\"reference-link\" href=\"#root/_help_IakOLONlIfGI\">Cloning Notes</a> for details.</p><p>Tree structure of notes can resemble file system - but compared to that notes in Trilium can act as both file and directory - meaning that note can both have its own content and have children. \"Leaf note\" is a note which doesn't have any children.</p><h3>Deleting / undeleting notes</h3><p>When you delete a note in Trilium, it is actually only marked for deletion (soft-delete) - the actual content, title, attributes etc. are not deleted, only hidden.</p><p>Within (by default) 7 days, it is possible to undelete these soft-deleted notes - open the <a class=\"reference-link\" href=\"#root/_help_r5JGHN99bVKn\">Recent Changes</a> dialog, and you will see a list of all modified notes including the deleted ones. Notes available for undeletion have a link to do so. This is kind of \"trash can\" functionality known from e.g. Windows.</p><p>Clicking an undelete will recover the note, its content and attributes - note should be just as before being deleted. This action will also undelete note's children which have been deleted in the same action.</p><p>To be able to undelete a note, it is necessary that deleted note's parent must be undeleted (otherwise there's no place where we can undelete it to). This might become a problem when you delete more notes in succession - the solution is then undelete in the reverse order of your deletion.</p><p>After the 7 days (configurable) the notes will be \"erased\" - their title, content, revisions and attributes will be erased, and it will not be possible anymore to recover them (unless you restore a <a class=\"reference-link\" href=\"#root/_help_ODY7qQn5m2FT\">Backup</a>).</p><h2>See also</h2><ul><li><a class=\"reference-link\" href=\"#root/_help_CoFPLs3dRlXc\">Read-Only Notes</a></li></ul>","_help_l7pigIGu01K2": "<p>Alongside its content, the <strong>title</strong> is one of the two main attributes of a <a href=\"#root/_help_BFs8mudNFgCS\">note</a>. It's the short, human-readable name shown in the editable field at the top of every note, and it's what identifies the note throughout the interface (in the <a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a>, in tabs, in the <a class=\"reference-link\" href=\"#root/_help_I6p2a06hdnL6\">Breadcrumb</a> and win <a class=\"reference-link\" href=\"#root/_help_hrZ1D00cLbal\">Internal (reference) links</a>.</p><p>Internally, notes are identified by a unique <a class=\"reference-link\" href=\"#root/_help_m1lbrzyKDaRB\">Note ID</a> rather than by their title, so the title is purely for your benefit. This has a few consequences:</p><ul><li><strong>Titles don't have to be unique.</strong> You can have any number of notes that share the same title without conflict.</li><li><strong>Renaming a note never breaks links to it.</strong> Links between notes point at the underlying note, so changing a title leaves existing links intact (they'll simply display the new title).</li><li><strong>The title can be left empty.</strong> Notes with no title display a placeholder (<em>type note's title here…</em>) but are otherwise perfectly valid.</li></ul><p>In addition:</p><ul><li>There is no limitation on the length of the title, however in exports the title might get trimmed.</li><li>There are no forbidden symbols, unsupported characters will get trimmed when exporting.</li><li>When exporting to a ZIP file, a meta file will contain the full title which will be recognized by Trilium when importing again.</li></ul><h2>Inline title</h2><p><a class=\"reference-link\" href=\"#root/_help_iPIMuisry3hd\">Text</a> notes have a special title bar behavior in which the <a href=\"#root/_help_l7pigIGu01K2\">note title</a> is initially displayed in a larger font, while also displaying additional information such as the creation and the modification date.</p><p>Whenever the title is scrolled past, the fixed title is shown instead.</p><p>Note types that take the entirety of the screen, such as <a class=\"reference-link\" href=\"#root/_help_6f9hih2hXXZk\">Code</a> and <a class=\"reference-link\" href=\"#root/_help_grjYqerjn243\">Canvas</a>, will always have only the fixed title bar.</p><p>Under the note title, the <a class=\"reference-link\" href=\"#root/_help_m3VlURMSeOrd\">New note type switcher</a> appears if the note is empty.</p><figure class=\"image\"><img style=\"aspect-ratio:899/122;\" src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/Notes/Title_image.png\" width=\"899\" height=\"122\"><figcaption>The <em>Inline title</em>, which is displayed at the top of the note and can be scrolled past.</figcaption></figure><figure class=\"image\"><img style=\"aspect-ratio:910/104;\" src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/Notes/1_Title_image.png\" width=\"910\" height=\"104\"><figcaption>The fixed title bar. The title only appears after scrolling past the <em>Inline title</em>.</figcaption></figure><h3>Editing the title</h3><p>To rename a note, simply click into the title field and type. Changes are saved automatically as you type.</p><p>You can also begin editing the title directly from the <a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a> by selecting a note and pressing <kbd>Enter</kbd> (see <em>Edit note title</em> in <a class=\"reference-link\" href=\"#root/_help_A9Oc6YKKc65v\">Keyboard Shortcuts</a>), which focuses the title field for the active note.</p><aside class=\"admonition note\"><p>Titles may contain any characters, including Unicode and emoji. For security, any HTML in the title is stripped automatically, so the title is always treated as plain text.</p></aside><h3>Easily navigating between the title and the content</h3><p>When the cursor is in the title field, pressing <kbd>Enter</kbd> moves focus into the note's content. For <a class=\"reference-link\" href=\"#root/_help_iPIMuisry3hd\">Text</a> notes this also inserts a fresh empty paragraph at the very top of the document, so you can start writing immediately — much like other note-taking apps.</p><p>This makes it possible to create a note, type its title, press <kbd>Enter</kbd>, and continue straight into the body without reaching for the mouse.</p><h3>Working with new notes</h3><p>When you create a new note it's given a default title (<em>new note</em>) which is pre-selected, so you can type a name right away to replace it. The default title for new notes can be customized per-section — see <a class=\"reference-link\" href=\"#root/_help_47ZrP6FNuoG8\">Default Note Title</a>.</p><p>If you decide you don't want the note after all, pressing <kbd>Escape</kbd> while the title of a freshly created note is still focused will discard it.</p><h3>Automatically generated titles</h3><p>Some notes get their titles assigned automatically rather than typed:</p><ul><li><strong>Day, week, month and year notes</strong> in the <a class=\"reference-link\" href=\"#root/_help_l0tKav7yLHGF\">Day Notes</a> are named from a configurable date pattern.</li><li><a class=\"reference-link\" href=\"#root/_help_m523cpzocqaD\">Saved Search</a> notes are named after the search they perform.</li><li>When a note is duplicated, a suffix is appended to the copy's title to tell it apart from the original.</li></ul><h3>Protected notes</h3><p>The titles of <a class=\"reference-link\" href=\"#root/_help_bwg0e8ewQMak\">Protected Notes</a> are encrypted along with their content. Before entering your password, Trilium cannot decrypt the title: the note tree, the title field and the breadcrumb menus label the note <em>Protected</em>, the tab shows <code>[protected]</code>, and the title cannot be modified.</p><p>Once you enter your password and a protected session is active, the real title is decrypted and displayed, and becomes editable again.</p>","_help_p9kXRFAkwN4o": "<h2>Icons</h2><figure class=\"image image-style-align-right image_resized\" style=\"width:48.4%;\"><img style=\"aspect-ratio:1089/995;\" src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/Notes/Note%20Icons%20%26%20Colors_image.png\" width=\"1089\" height=\"995\"></figure><p>Icons are useful for distinguishing notes and are displayed near the note title, as well as in various places such as the <a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a>, <a class=\"reference-link\" href=\"#root/_help_hrZ1D00cLbal\">Internal (reference) links</a> or the <a class=\"reference-link\" href=\"#root/_help_F1r9QtzQLZqm\">Jump to & command palette</a>.</p><p>While editing a note, click on the icon next to the title to bring up a chooser gallery.</p><p>Icons can be inherited through the use of <a class=\"reference-link\" href=\"#root/_help_KC1HB96bqqHX\">Templates</a>, or <a class=\"reference-link\" href=\"#root/_help_bwZpz2ajCEwO\">Attribute Inheritance</a>.</p><aside class=\"admonition note\"><p>At the technical level, they are set by the <code>iconClass</code> attribute which adds a CSS class to the note. For example <code>#iconClass=\"bx bx-calendar\"</code> will show a calendar instead of the default page or folder icon. Looking up and remembering the CSS class names is not necessary.</p></aside><h2>Colors</h2><p>Notes can also carry a custom color. Similar to the note icon, this color will be shown in various places such as the <a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a> and <a class=\"reference-link\" href=\"#root/_help_hrZ1D00cLbal\">Internal (reference) links</a>.</p><p>To set a custom color, right click on the note in the <a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a> and select a predefined color from there or use the color picker (last option).</p><p>Alternatively, a custom color can be set manually through the <code>#color</code> <a href=\"#root/_help_HI6GBBIduIgv\">label</a>, whose value must be a valid hex color including the leading <code>#</code> (e.g. <code>#ff0000</code> for red). This color can be carried over across multiple notes via <a class=\"reference-link\" href=\"#root/_help_bwZpz2ajCEwO\">Attribute Inheritance</a>.</p>",diff --git a/docs/User Guide/User Guide/Basic Concepts and Features/UI Elements/Breadcrumb.md b/docs/User Guide/User Guide/Basic Concepts and Features/UI Elements/Breadcrumb.mdindex fb27f092a2..053d6ec442 100644--- a/docs/User Guide/User Guide/Basic Concepts and Features/UI Elements/Breadcrumb.md+++ b/docs/User Guide/User Guide/Basic Concepts and Features/UI Elements/Breadcrumb.md@@ -17,6 +17,7 @@ It is part of the <a class="reference-link" href="Status%20bar.md">Status bar</* Right clicking will open a menu with multiple options such as opening the note in a different tab/split/window, hoisting, moving/cloning the note, duplicating as well as changing the color of the note.* Clicking the arrow next to each segment will reveal the child notes of the segment on the left.* Clicking on an icon will navigate to that particular note.+ * To find a child note by its title, start typing: the field at the bottom of the menu filters the list.* It's also possible to create a new child note from here.* The menu can optionally hide the archived notes.* If the current note is deep within a hierarchy, the segments will collapse into a \[…\] button in order not to occupy too much space.