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/launch bar/note bookmarks: rewrite the bookmark folder component
Adorian Doranc2be7f926632
diff --git a/apps/client/src/menus/context_menu.spec.ts b/apps/client/src/menus/context_menu.spec.tsindex 3f0767e7c1..4cbec59195 100644--- a/apps/client/src/menus/context_menu.spec.ts+++ b/apps/client/src/menus/context_menu.spec.ts@@ -926,11 +926,15 @@ describe("contextMenu", () => {{ kind: "separator" as const },{ title: "Collection", items: [ { title: "Table" }, { title: "Board", badges: [ { title: "New" } ] } ] },{ kind: "header" as const, title: "Templates" },+ // As `menuName()` boxes a name.+ { title: "<span class=\"tn-menu-name\">Weekly review</span>" },{ title: "Meeting & <b>notes</b>" }]}];- const unfiltered = [ "Text|", "Code|", "Collection|", "Meeting & notes|" ];+ const unfiltered = [+ "Text|", "Code|", "Collection|", "Weekly review|", "Meeting & notes|"+ ];async function openFilterable(picked: string[] = []) {buildPage();@@ -1069,6 +1073,13 @@ describe("contextMenu", () => {// The title is HTML; what is matched and shown is its text, and none of its markup.await vi.waitFor(() => expect(layer().rows).toEqual([ "Meeting & notes|" ]));expect(menuElement()?.querySelector(".tn-menu-filter-title b")).toBeNull();+ expect(menuElement()?.querySelector(".tn-menu-filter-title.tn-menu-name")).toBeNull();++ // A name keeps the box that caps its width.+ edit("week");+ await vi.waitFor(() => expect(layer().rows).toEqual([ "Weekly review|" ]));+ expect(menuElement()?.querySelector(".tn-menu-filter-title")?.classList)+ .toContain("tn-menu-name");edit("& nzz");await vi.waitFor(() => expect(layer().empty).toBe(true));diff --git a/apps/client/src/stylesheets/theme-next/shell.css b/apps/client/src/stylesheets/theme-next/shell.cssindex 66e660fd97..5dae6e6930 100644--- a/apps/client/src/stylesheets/theme-next/shell.css+++ b/apps/client/src/stylesheets/theme-next/shell.css@@ -476,56 +476,6 @@ body .calendar-dropdown-widget .calendar-body a.calendar-date-active {color: var(--calendar-day-selected-color) !important;}-/*- * Bookmarks folder popup- */--div.bookmark-folder-widget {- min-width: auto;- max-width: 40vw;- padding: 0;- font-size: 1.1em;-}--div.bookmark-folder-widget .children-notes {- margin: 0;-}--/* Item */-div.bookmark-folder-widget span.note-link {- display: flex;- align-items: center;- white-space: nowrap;- border-radius: 6px;- padding: 6px 25px;-}--/* Item: the parent note */-div.bookmark-folder-widget .parent-note .note-link {- padding: 6px 8px;- font-weight: bold;-}--div.bookmark-folder-widget .note-link:hover {- background: var(--hover-item-background-color);-}--div.bookmark-folder-widget .note-link a {- padding-inline-start: 8px;- color: var(--menu-text-color);- cursor: default;-}--div.bookmark-folder-widget .note-link:hover a {- color: var(--hover-item-text-color);-}--/* The item's icon */-div.bookmark-folder-widget .note-link .tn-icon {- color: var(--menu-item-icon-color);- font-size: 1.2em;-}-/** QUICK SEARCH BOX*/diff --git a/apps/client/src/widgets/launch_bar/BookmarkButtons.css b/apps/client/src/widgets/launch_bar/BookmarkButtons.cssindex b38ba59c08..dbd2785e08 100644--- a/apps/client/src/widgets/launch_bar/BookmarkButtons.css+++ b/apps/client/src/widgets/launch_bar/BookmarkButtons.css@@ -1,31 +1,7 @@-.bookmark-folder-widget {- min-width: 400px;- max-height: 500px;- padding: 7px 15px 0 15px;- font-size: 1.2rem;- overflow: auto;+.dropdown-item.bookmark-folder-note {+ font-weight: 600;}-.bookmark-folder-widget ul {- padding: 0;- list-style-type: none;+.dropdown-item.bookmark-folder-child > span > .tn-icon {+ margin-inline-start: 20px;}--.bookmark-folder-widget .note-link {- display: block;- padding: 5px 10px 5px 5px;-}--.bookmark-folder-widget .note-link:hover {- background-color: var(--accented-background-color);- text-decoration: none;-}--.dropdown-menu .bookmark-folder-widget a:hover:not(.disabled) {- text-decoration: none;- background-color: transparent !important;-}--.bookmark-folder-widget li .note-link {- padding-inline-start: 35px;-}\ No newline at end of filediff --git a/apps/client/src/widgets/launch_bar/BookmarkButtons.spec.tsx b/apps/client/src/widgets/launch_bar/BookmarkButtons.spec.tsxnew file mode 100644index 0000000000..34079b3aa3--- /dev/null+++ b/apps/client/src/widgets/launch_bar/BookmarkButtons.spec.tsx@@ -0,0 +1,237 @@+import { act } from "preact/test-utils";+import { afterEach, describe, expect, it, vi } from "vitest";++import type FNote from "../../entities/fnote";+import { buildNote } from "../../test/easy-froca";+import { renderInto } from "../../test/render";+import { BookmarkFolder } from "./BookmarkButtons";++const h = vi.hoisted(() => ({ isMobile: false, opened: [] as string[] }));++vi.mock("../../services/utils", async (importOriginal) => ({+ ...await importOriginal<typeof import("../../services/utils")>(),+ isMobile: () => h.isMobile+}));+vi.mock("./GenericButtons", async (importOriginal) => ({+ ...await importOriginal<typeof import("./GenericButtons")>(),+ launchCustomNoteLauncher: vi.fn(async (_e: MouseEvent, { launcherNote, getTargetNoteId }: {+ launcherNote: FNote,+ getTargetNoteId: (launcherNote: FNote) => string+ }) => {+ h.opened.push(getTargetNoteId(launcherNote));+ })+}));++afterEach(() => {+ h.isMobile = false;+ h.opened.length = 0;+ document.body.classList.remove("motion-disabled");+});++describe("BookmarkFolder", () => {+ /** A folder whose `branch` child has children, and whose `hidden` child hides its own. */+ function buildFolder() {+ return buildNote({+ id: "folder",+ title: "Folder",+ "#bookmarkFolder": "",+ children: [+ { id: "first", title: "First" },+ { id: "branch", title: "Branch", children: [ { id: "leaf", title: "Leaf" } ] },+ {+ id: "hidden",+ title: "Hidden",+ "#subtreeHidden": "",+ children: [ { id: "secret", title: "Secret" } ]+ }+ ]+ });+ }++ /** Opens the folder's menu, once its `rowCount` rows are drawn. */+ async function openMenu(note: FNote, rowCount: number) {+ const container = renderInto(<BookmarkFolder note={note} />);+ const toggle = container.querySelector<HTMLElement>(".right-dropdown-button");+ if (!toggle) throw new Error("expected the folder's button to render");+ await act(async () => {+ toggle.dispatchEvent(new PointerEvent("pointerdown", { bubbles: true }));+ toggle.click();+ await Promise.resolve();+ });+ return await vi.waitFor(() => {+ const menu = popup();+ expect(rowsOf(menu)).toHaveLength(rowCount);+ if (!menu) throw new Error("expected the folder's menu to open");+ return menu;+ });+ }++ const popup = () => document.querySelector<HTMLElement>(".tn-popup.tn-menu");+ const rowsOf = (level: Element | null | undefined) => [ ...level?.querySelectorAll<HTMLElement>(+ ":scope > .tn-menu-scroll > li, :scope > .tn-menu-filterable > .tn-menu-scroll > li"+ ) ?? [] ];+ const filterInputOf = (level: Element | undefined) => level?.querySelector<HTMLInputElement>(+ ":scope > .tn-menu-filterable input.tn-menu-filter-input"+ ) ?? null;+ const layerElements = (menu: HTMLElement) =>+ [ ...menu.querySelectorAll<HTMLElement>(":scope > div.dropdown-submenu > .dropdown-menu") ];+ /** The open submenus' layers, each as its rows. */+ const layers = (menu: HTMLElement) => layerElements(menu).map(rowsOf);+ const titles = (rows: HTMLElement[]) => rows.map((row) => row.textContent);+ /** Whether a row is the folder's note or one of its children, and whether it is a split row. */+ const kindOf = (row: HTMLElement) => [+ row.classList.contains("bookmark-folder-note") && "note",+ row.classList.contains("bookmark-folder-child") && "child",+ row.classList.contains("dropdown-submenu") && row.classList.contains("tn-menu-split")+ && "submenu"+ ].filter(Boolean).join(" ");++ function rowTitled(rows: HTMLElement[], title: string) {+ const row = rows.find((candidate) => candidate.textContent === title);+ if (!row) throw new Error(`expected a row titled ${title}`);+ return row;+ }++ const press = (element: HTMLElement) => {+ const init = { bubbles: true, cancelable: true, button: 0 };+ element.dispatchEvent(new MouseEvent("mousedown", init));+ element.dispatchEvent(new MouseEvent("click", init));+ };++ async function type(input: HTMLInputElement, text: string) {+ await act(async () => {+ input.value = text;+ input.dispatchEvent(new Event("input", { bubbles: true }));+ });+ }++ it("lists the folder note, then its children, with submenus for those shown", async () => {+ const menu = await openMenu(buildFolder(), 4);+ const rows = rowsOf(menu);++ expect(titles(rows)).toEqual([ "Folder", "First", "Branch", "Hidden" ]);+ expect(rows.map(kindOf)).toEqual([ "note", "child", "child submenu", "child" ]);+ // The submenu's rows are drawn only once it opens.+ expect(document.body.textContent).not.toContain("Leaf");++ const arrow = rowTitled(rows, "Branch").querySelector<HTMLElement>(".tn-menu-split-toggle");+ if (!arrow) throw new Error("expected the split row to draw its arrow");+ press(arrow);+ await vi.waitFor(() => expect(layers(menu).map(titles)).toEqual([ [ "Leaf" ] ]));+ expect(layers(menu)[0].map(kindOf)).toEqual([ "" ]);+ expect(h.opened).toEqual([]);+ });++ it("opens the note of the row picked and closes the menu, a split row's too", async () => {+ const folder = buildFolder();+ let menu = await openMenu(folder, 4);+ press(rowTitled(rowsOf(menu), "Branch"));+ expect(h.opened).toEqual([ "branch" ]);+ await vi.waitFor(() => expect(popup()).toBeNull());++ menu = await openMenu(folder, 4);+ press(rowTitled(rowsOf(menu), "Folder"));+ expect(h.opened).toEqual([ "branch", "folder" ]);+ await vi.waitFor(() => expect(popup()).toBeNull());+ });++ it("nests submenus four levels deep, listing the notes below as plain rows", async () => {+ const deep = buildNote({+ title: "Deep",+ children: [ { id: "l1", title: "L1", children: [ { id: "l2", title: "L2", children: [+ { id: "l3", title: "L3", children: [ { id: "l4", title: "L4", children: [+ { id: "l5", title: "L5", children: [ { id: "l6", title: "L6" } ] }+ ] } ] }+ ] } ] } ]+ });+ const menu = await openMenu(deep, 2);++ let rows = rowsOf(menu);+ for (const [ depth, title ] of [ "L1", "L2", "L3", "L4" ].entries()) {+ const row = rowTitled(rows, title);+ expect(row.classList).toContain("tn-menu-split");+ row.dispatchEvent(new PointerEvent("pointerenter"));+ rows = await vi.waitFor(() => {+ const opened = layers(menu);+ expect(opened).toHaveLength(depth + 1);+ expect(opened[depth].length).toBeGreaterThan(0);+ return opened[depth];+ });+ }++ expect(titles(rows)).toEqual([ "L5" ]);+ expect(rows.map(kindOf)).toEqual([ "" ]);+ expect(rows[0].classList).not.toContain("dropdown-submenu");+ });++ it("offers a filter on a level of more than 15 children, which lists the matches", async () => {+ const numbered = (title: string, count: number) =>+ Array.from({ length: count }, (_, index) => ({+ id: `${title.toLowerCase()}${index + 1}`, title: `${title} ${index + 1}`+ }));+ const folder = buildNote({+ title: "Folder",+ children: [+ ...numbered("Note", 14),+ { id: "many", title: "Many", children: numbered("Item", 16) },+ { id: "few", title: "Few", children: numbered("Leaf", 15) }+ ]+ });+ let menu = await openMenu(folder, 17);+ expect(filterInputOf(menu)).not.toBeNull();++ rowTitled(rowsOf(menu), "Few").dispatchEvent(new PointerEvent("pointerenter"));+ await vi.waitFor(() => expect(layers(menu)[0]).toHaveLength(15));+ expect(filterInputOf(layerElements(menu)[0])).toBeNull();++ rowTitled(rowsOf(menu), "Many").dispatchEvent(new PointerEvent("pointerenter"));+ await vi.waitFor(() => expect(layers(menu)[0]).toHaveLength(16));+ const submenuInput = filterInputOf(layerElements(menu)[0]);+ if (!submenuInput) throw new Error("expected the submenu to offer a filter");+ await type(submenuInput, "16");+ const matches = await vi.waitFor(() => {+ const found = layers(menu)[0];+ expect(titles(found)).toEqual([ "Item 16" ]);+ return found;+ });+ press(matches[0]);+ expect(h.opened).toEqual([ "item16" ]);+ await vi.waitFor(() => expect(popup()).toBeNull());++ // The folder's own note is filtered along with its children.+ menu = await openMenu(folder, 17);+ const input = filterInputOf(menu);+ if (!input) throw new Error("expected the folder's menu to offer a filter");+ await type(input, "f");+ await vi.waitFor(() => expect(titles(rowsOf(menu))).toEqual([ "Folder", "Few" ]));+ // The titles keep the box that caps their width, as the rows' do.+ expect(rowsOf(menu).map((row) => row.querySelector(".tn-menu-name")?.textContent))+ .toEqual([ "Folder", "Few" ]);+ press(rowTitled(rowsOf(menu), "Few"));+ expect(h.opened).toEqual([ "item16", "few" ]);+ });++ it("lists a submenu's note above its children on a phone, without split rows", async () => {+ h.isMobile = true;+ // Without slides, a page opens as soon as its row is tapped.+ document.body.classList.add("motion-disabled");+ const menu = await openMenu(buildFolder(), 4);++ const branch = rowTitled(rowsOf(menu), "Branch");+ expect(branch.querySelector(".tn-menu-split-toggle")).toBeNull();+ press(branch);++ const pageRows = await vi.waitFor(() => {+ const found = [+ ...menu.querySelectorAll<HTMLElement>(":scope > .tn-menu-page .tn-menu-scroll > li")+ ];+ expect(titles(found)).toEqual([ "Branch", "Leaf" ]);+ return found;+ });+ expect(h.opened).toEqual([]);+ expect(pageRows.map(kindOf)).toEqual([ "note", "child" ]);++ press(pageRows[0]);+ expect(h.opened).toEqual([ "branch" ]);+ });+});diff --git a/apps/client/src/widgets/launch_bar/BookmarkButtons.tsx b/apps/client/src/widgets/launch_bar/BookmarkButtons.tsxindex 73b997c7cc..ebd56216d1 100644--- a/apps/client/src/widgets/launch_bar/BookmarkButtons.tsx+++ b/apps/client/src/widgets/launch_bar/BookmarkButtons.tsx@@ -4,15 +4,25 @@ import { CSSProperties } from "preact";import { useContext, useMemo } from "preact/hooks";import type FNote from "../../entities/fnote";+import type { MenuCommandItem } from "../../menus/context_menu";+import { menuName } from "../../menus/context_menu_utils";import { t } from "../../services/i18n";+import { isMobile } from "../../services/utils";import { FormDropdownSubmenu, FormListItem } from "../react/FormList";-import { useChildNotes, useNote, useNoteIcon, useNoteLabelBoolean } from "../react/hooks";-import NoteLink from "../react/NoteLink";+import {+ useChildNotes, useNote, useNoteIcon, useNoteLabelBoolean, useNoteProperty+} from "../react/hooks";+import { MenuItemRows } from "../react/Menu";+import { MenuFilterContext } from "../react/menu_context";import ResponsiveContainer from "../react/ResponsiveContainer";import { CustomNoteLauncher, launchCustomNoteLauncher } from "./GenericButtons";import { LaunchBarContext, LaunchBarDropdownButton, launcherContextMenuHandler, LauncherNoteProps, useLauncherIconAndTitle } from "./launch_bar_widgets";const PARENT_NOTE_ID = "_lbBookmarks";+/** The deepest a folder's submenus nest below the folder's own menu. */+const MAX_SUBMENU_DEPTH = 4;+/** The most children a menu lists without a filter input above them. */+const MAX_UNFILTERED_CHILDREN = 15;export default function BookmarkButtons({ launcherNote }: LauncherNoteProps) {const { isHorizontalLayout } = useContext(LaunchBarContext);@@ -63,37 +73,25 @@ function SingleBookmark({ note }: { note: FNote }) {function MobileBookmarkItem({ noteId, bookmarkFolder }: { noteId: string, bookmarkFolder: boolean }) {const note = useNote(noteId);- const noteIcon = useNoteIcon(note);if (!note) return null;- return (- !bookmarkFolder- ? <FormListItem icon={noteIcon} onClick={(e) => launchCustomNoteLauncher(e, { launcherNote: note, getTargetNoteId: () => note.noteId })}>{note.title}</FormListItem>- : <MobileBookmarkFolder note={note} />- );+ return bookmarkFolder ? <MobileBookmarkFolder note={note} /> : <NoteRow note={note} />;}function MobileBookmarkFolder({ note }: { note: FNote }) {- const childNotes = useChildNotes(note.noteId);-return (- <FormDropdownSubmenu icon="bx bx-folder" title={note.title}>- {childNotes.map(childNote => (- <FormListItem- key={childNote.noteId}- icon={childNote.getIcon()}- onClick={(e) => launchCustomNoteLauncher(e, { launcherNote: childNote, getTargetNoteId: () => childNote.noteId })}- >- {childNote.title}- </FormListItem>- ))}+ <FormDropdownSubmenu+ icon="bx bx-folder" title={note.title} filterable={hasManyChildren(note)}+ >+ <FolderRows note={note} depth={0} /></FormDropdownSubmenu>);}/**- * A note with `#bookmarkFolder` in the launch bar, which lists its children. `parentNoteId` is the- * launch bar section that shows it, see `ShowLauncherContextMenuOptions`.+ * A note with `#bookmarkFolder` in the launch bar, which opens a menu of the note and its+ * children. `parentNoteId` is the launch bar section that shows it, see+ * `ShowLauncherContextMenuOptions`.*/export function BookmarkFolder({ note, parentNoteId }: { note: FNote, parentNoteId?: string }) {const { icon, title } = useLauncherIconAndTitle(note);@@ -101,25 +99,97 @@ export function BookmarkFolder({ note, parentNoteId }: { note: FNote, parentNotereturn (<LaunchBarDropdownButton- panellauncherNote={note}parentNoteId={parentNoteId}icon={icon}title={title}+ filterable={childNotes.length > MAX_UNFILTERED_CHILDREN}+ keepOrder>- <div className="bookmark-folder-widget">- <div className="parent-note">- <NoteLink notePath={note.noteId} noPreview showNoteIcon containerClassName="note-link" noTnLink />- </div>-- <ul className="children-notes">- {childNotes.map(childNote => (- <li key={childNote.noteId}>- <NoteLink notePath={childNote.noteId} noPreview showNoteIcon containerClassName="note-link" noTnLink />- </li>- ))}- </ul>- </div>+ <FolderRows note={note} depth={0} /></LaunchBarDropdownButton>);}++/**+ * The rows of `note`'s children, in a menu `depth` submenus below the folder's own. The folder's+ * menu lists `note` above its children, and so does every submenu on a phone, where a split row+ * only opens its submenu.+ */+function FolderRows({ note, depth }: { note: FNote, depth: number }) {+ const childNotes = useChildNotes(note.noteId);+ const filter = useContext(MenuFilterContext);+ const listsNote = depth === 0 || isMobile();++ // Only rows given as data can be filtered, so `MenuItemRows` draws the matches.+ if (filter?.text) {+ const notes = listsNote ? [ note, ...childNotes ] : childNotes;+ return <MenuItemRows items={notes.map(toMenuItem)} />;+ }++ return <>+ {listsNote && <NoteRow note={note} className="bookmark-folder-note" />}+ {childNotes.map((childNote) => (+ <NoteRow+ key={childNote.noteId}+ note={childNote}+ className={listsNote ? "bookmark-folder-child" : undefined}+ submenuDepth={depth + 1}+ />+ ))}+ </>;+}++interface NoteRowProps {+ note: FNote;+ className?: string;+ /**+ * The depth of the submenu that would list the note's children. Without it, or past+ * {@link MAX_SUBMENU_DEPTH}, the row only opens the note.+ */+ submenuDepth?: number;+}++/**+ * A row that opens `note`. A note with children it shows becomes a split row, whose arrow opens a+ * submenu of them; `#subtreeHidden` keeps them out, as it does in the note tree.+ */+function NoteRow({ note, className, submenuDepth }: NoteRowProps) {+ const icon = useNoteIcon(note);+ const title = useNoteProperty(note, "title");+ const [ isSubtreeHidden ] = useNoteLabelBoolean(note, "subtreeHidden");+ const label = <span className="tn-menu-name">{title}</span>;+ const open = (e: MouseEvent) => openNote(e, note);++ if (submenuDepth !== undefined && submenuDepth <= MAX_SUBMENU_DEPTH+ && note.hasChildren() && !isSubtreeHidden) {+ return (+ <FormDropdownSubmenu+ icon={icon} title={label} className={className}+ onDropdownToggleClicked={open} closeOnSelect filterable={hasManyChildren(note)}+ >+ <FolderRows note={note} depth={submenuDepth} />+ </FormDropdownSubmenu>+ );+ }++ return <FormListItem icon={icon} className={className} onClick={open}>{label}</FormListItem>;+}++/** Whether the submenu of `note`'s children offers a filter input above them. */+function hasManyChildren(note: FNote) {+ return note.getChildNoteIds().length > MAX_UNFILTERED_CHILDREN;+}++/** `note` as a menu item, which `MenuItemRows` can filter. */+function toMenuItem(note: FNote): MenuCommandItem<unknown> {+ return {+ title: menuName(note.title),+ uiIcon: note.getIcon(),+ handler: (_item, e) => openNote(e, note)+ };+}++function openNote(e: MouseEvent | KeyboardEvent, note: FNote) {+ void launchCustomNoteLauncher(e, { launcherNote: note, getTargetNoteId: () => note.noteId });+}diff --git a/apps/client/src/widgets/launch_bar/launch_bar_widgets.tsx b/apps/client/src/widgets/launch_bar/launch_bar_widgets.tsxindex 536aa8fd01..f4b43b122b 100644--- a/apps/client/src/widgets/launch_bar/launch_bar_widgets.tsx+++ b/apps/client/src/widgets/launch_bar/launch_bar_widgets.tsx@@ -59,6 +59,7 @@ export function LaunchBarDropdownButton({children, icon, launcherNote, parentNoteId, buttonProps, panel, ...props}: Pick<DropdownProps, "title" | "children" | "onShown" | "autoClose" | "dropdownRef" | "buttonProps"+ | "filterable" | "keepOrder"> & {icon: string,launcherNote?: FNote,diff --git a/apps/client/src/widgets/react/FormList.tsx b/apps/client/src/widgets/react/FormList.tsxindex d8c23008e6..75e31a3aac 100644--- a/apps/client/src/widgets/react/FormList.tsx+++ b/apps/client/src/widgets/react/FormList.tsx@@ -484,6 +484,8 @@ export interface FormDropdownSubmenuProps {* whether {@link onDropdownToggleClicked} is set.*/split?: boolean;+ /** Whether running {@link onDropdownToggleClicked} closes the menu, as `FormListItem` does. */+ closeOnSelect?: boolean;disabled?: boolean;className?: string;/** Inside a menu, whether typing while the submenu is open filters it. See `MenuCommandItem.filterable`. */@@ -506,7 +508,10 @@ export function FormDropdownSubmenu(props: FormDropdownSubmenuProps) {return <MenuSubmenu {...props} menu={menu} />;}-function MenuSubmenu({ menu, icon, iconSvg, title, description, children, onDropdownToggleClicked, split = !!onDropdownToggleClicked, disabled, className, filterable, tile }: FormDropdownSubmenuProps & { menu: MenuContextValue }) {+function MenuSubmenu({+ menu, icon, iconSvg, title, description, children, onDropdownToggleClicked,+ split = !!onDropdownToggleClicked, closeOnSelect, disabled, className, filterable, tile+}: FormDropdownSubmenuProps & { menu: MenuContextValue }) {const level = useContext(MenuLevelContext);const id = useUniqueName("menu-row");const openSubmenu = menu.open[level];@@ -516,9 +521,15 @@ function MenuSubmenu({ menu, icon, iconSvg, title, description, children, onDrop// A phone's page that closes keeps being drawn until it has slid out.const pageSlide = useSlide(open);+ function run(e: MouseEvent) {+ onDropdownToggleClicked?.(e);+ if (closeOnSelect) menu.close();+ }+/** Runs the row's own action for the keys, with the modifiers of the key that ran it. */function select(e: MouseEvent | KeyboardEvent) {- onDropdownToggleClicked?.(new MouseEvent("click", { ctrlKey: e.ctrlKey, shiftKey: e.shiftKey, altKey: e.altKey, metaKey: e.metaKey }));+ const { ctrlKey, shiftKey, altKey, metaKey } = e;+ run(new MouseEvent("click", { ctrlKey, shiftKey, altKey, metaKey }));}function onPointed(e: { currentTarget: HTMLLIElement }) {@@ -612,7 +623,7 @@ function MenuSubmenu({ menu, icon, iconSvg, title, description, children, onDrope.stopPropagation();if (disabled) return;menu.openSubmenu(level, id, e.currentTarget, true);- if (!isMobile()) onDropdownToggleClicked?.(e);+ if (!isMobile()) run(e);}}><span className="dropdown-toggle">diff --git a/apps/client/src/widgets/react/Menu.spec.tsx b/apps/client/src/widgets/react/Menu.spec.tsxindex 2bab0f7e51..adfed73ea1 100644--- a/apps/client/src/widgets/react/Menu.spec.tsx+++ b/apps/client/src/widgets/react/Menu.spec.tsx@@ -279,6 +279,41 @@ describe("Menu with declared rows", () => {expect(toggled).toHaveBeenCalledOnce();});+ it("closes the menu after a split row's own action only when asked to", async () => {+ const onClose = vi.fn();+ render((+ <Menu anchor={{ x: 10, y: 10 }} onClose={onClose}>+ <FormDropdownSubmenu+ title="Duplicate" icon="bx bx-outline" onDropdownToggleClicked={vi.fn()}+ >+ <FormListItem>This note only</FormListItem>+ </FormDropdownSubmenu>+ <FormDropdownSubmenu+ title="Open" icon="bx bx-folder" onDropdownToggleClicked={vi.fn()} closeOnSelect+ >+ <FormListItem>Child</FormListItem>+ </FormDropdownSubmenu>+ </Menu>+ ), host);+ const menu = document.querySelector<HTMLElement>(".tn-popup.tn-menu");+ if (!menu) throw new Error("expected the menu to render");++ key(menu, "ArrowUp");+ await vi.waitFor(() => expect(activeTitle(menu)).toBe("Open"));+ key(menu, "Enter");+ expect(onClose).toHaveBeenCalledOnce();++ press(rowTitled("Duplicate"));+ const arrow = rowTitled("Open").querySelector<HTMLElement>(".tn-menu-split-toggle");+ if (!arrow) throw new Error("expected the split row to draw its arrow as a target");+ press(arrow);+ await vi.waitFor(() => expect(layers(menu)).toEqual([ [ "Child" ] ]));+ expect(onClose).toHaveBeenCalledOnce();++ press(rowTitled("Open"));+ expect(onClose).toHaveBeenCalledTimes(2);+ });+it("neither opens nor runs a disabled submenu row", async () => {const toggled = vi.fn();render((diff --git a/apps/client/src/widgets/react/Menu.tsx b/apps/client/src/widgets/react/Menu.tsxindex 199e492ba8..028d7d1432 100644--- a/apps/client/src/widgets/react/Menu.tsx+++ b/apps/client/src/widgets/react/Menu.tsx@@ -537,14 +537,16 @@ function FilteredMenuItems<T>({ items, text, bottomUp, onSelect }: {if (bottomUp) matches.reverse();return <>{matches.length === 0 && <li className="tn-menu-filter-empty" role="none">{t("menu.no_matches")}</li>}- {matches.map(([ index, { item, title, path } ]) => (+ {matches.map(([ index, { item, title, isName, path } ]) => (<FormListItemkey={index}icon={item.uiIcon ?? "bx bx-empty"} iconClassName={item.iconColorClass}badges={item.badges?.map((badge) => ({ className: badge.className, text: badge.title }))}closeOnSelect={false} onClick={(e) => onSelect?.(item, e)}>- <span className="tn-menu-filter-title">{highlightMatch(title, text)}</span>+ <span className={clsx("tn-menu-filter-title", isName && "tn-menu-name")}>+ {highlightMatch(title, text)}+ </span>{path.length > 0 && <span className="tn-menu-filter-path">{path.join(" › ")}</span>}</FormListItem>))}@@ -687,6 +689,8 @@ interface MenuMatch<T> {item: MenuCommandItem<T>;/** The title as text. */title: string;+ /** Whether the title is a name boxed by `menuName()`, whose width the match caps as well. */+ isName: boolean;/** The titles of the submenus the item stands in, outermost first. */path: string[];}@@ -717,7 +721,7 @@ function filterMenuItems<T>(items: MenuItem<T>[], text: string): MenuMatch<T>[]const haystack = [ ...path, title ].join(" ").toLowerCase();if (!words.every((word) => haystack.includes(word))) continue;const rank = lowerTitle.startsWith(query) ? 0 : lowerTitle.includes(query) ? 1 : 2;- found.push({ item, title, path, rank });+ found.push({ item, title, isName: isMenuName(item.title), path, rank });}}@@ -725,14 +729,24 @@ function filterMenuItems<T>(items: MenuItem<T>[], text: string): MenuMatch<T>[]return found.sort((a, b) => a.rank - b.rank);}+/** The text an item's title shows. */+function textOf(html: string) {+ return parseTitle(html).textContent ?? "";+}++/** Whether an item's title is a name boxed by `menuName()`. */+function isMenuName(html: string) {+ return !!parseTitle(html).querySelector(".tn-menu-name");+}+/**- * The text an item's title shows. Titles are HTML, read through a `<template>`, whose content is- * inert: an `<img>` in it neither loads nor runs its handlers, as one in a detached `<div>` would.+ * An item's title, which is HTML, read through a `<template>`, whose content is inert: an `<img>`+ * in it neither loads nor runs its handlers, as one in a detached `<div>` would.*/-function textOf(html: string) {+function parseTitle(html: string) {const template = document.createElement("template");template.innerHTML = html;- return template.content.textContent ?? "";+ return template.content;}/** `title` with the first place the typed text, or else one of its words, occurs in it marked. */diff --git a/apps/server/src/assets/help/help_content.json b/apps/server/src/assets/help/help_content.jsonindex 1a1a3bd5bb..b35c2c2313 100644--- a/apps/server/src/assets/help/help_content.json+++ b/apps/server/src/assets/help/help_content.json@@ -86,7 +86,7 @@"_help_eIg8jdvaoNNd": "<figure class=\"image\"><img style=\"aspect-ratio:987/725;\" src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/Navigation/Search_image.png\" width=\"987\" height=\"725\"></figure><p>Note search enables you to find notes by searching for text in the title, content, or <a href=\"#root/_help_zEY4DaJG4YT5\">attributes</a> of the notes. You also have the option to save your searches, which will create a special search note which is visible on your navigation tree and contains the search results as sub-items.</p><h2>Types of search</h2><p>There are multiple types of searches, all using the same search mechanism and query language:</p><ul><li><a class=\"reference-link\" href=\"#root/_help_Ms1nauBra7gq\">Quick search</a> which can be found in the <a class=\"reference-link\" href=\"#root/_help_xYmIYSP6wE3F\">Launch Bar</a> for small one-off searches.<ul><li>The results are shown in a popup and it has an infinite scroll.</li></ul></li><li><em>Full search</em> is the more advanced search mechanism.<ul><li>The results are displayed in a separate page and it has multiple advanced features (search script, fast search, include archived notes, order by, limit).</li><li><a class=\"reference-link\" href=\"#root/_help_ivYnonVFBxbQ\">Bulk Actions</a> such as adding a label/relation can be applied to the results.</li><li>The results are paginated and they can be displayed in any <a class=\"reference-link\" href=\"#root/_help_GTwFsgaA0lCt\">Collections</a> view (e.g. grid, list, calendar, table).</li></ul></li><li>Some <a class=\"reference-link\" href=\"#root/_help_GTwFsgaA0lCt\">Collections</a> such as board view have a dedicated search bar which applies to that collection.<ul><li>In this case, the results are displayed directly in the collection instead of a popup and they are limited to the collection but the query language remains the same.</li></ul></li></ul><aside class=\"admonition note\"><p><a href=\"#root/_help_F1r9QtzQLZqm\">Jump to note</a> is a similar concept but it's mainly used to search for notes by title, not by content. Nevertheless, it also features a way to search in full text if the results are unsatisfactory.</p></aside><h2>Accessing the search</h2><ul><li>From the <a class=\"reference-link\" href=\"#root/_help_xYmIYSP6wE3F\">Launch Bar</a>, look for the dedicated <span class=\"tn-icon bx bx-search\"></span> search button.</li><li>To limit the search to a note and its children, select <em>Search in subtree</em> (<span class=\"tn-icon bx bx-search\"></span>) from the <a class=\"reference-link\" href=\"#root/_help_YtSN43OrfzaA\">Note tree contextual menu</a> or press <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>S</kbd>.</li><li>Go to <a class=\"reference-link\" href=\"#root/_help_F1r9QtzQLZqm\">Jump to & command palette</a>, look for something then press <em>Show in full search</em> below the results (or <kbd>Ctrl</kbd>+<kbd>Enter</kbd>).</li></ul><h2>Interaction</h2><p>To search for notes, click on the <span class=\"tn-icon bx bx-search\"></span> icon in the <a class=\"reference-link\" href=\"#root/_help_xYmIYSP6wE3F\">Launch Bar</a> or press the keyboard <a href=\"#root/_help_A9Oc6YKKc65v\">shortcut</a>.</p><ol><li>Set the text to search for in the <em>Search string</em> field.<ol><li>Apart from searching for words literally, there is also the possibility to search for attributes or properties of notes.</li><li>See the examples below for more information.</li></ol></li><li>To limit the search to a note and its sub-children, set a note in <em>Ancestor</em>.<ol><li>This value is also pre-filled if the search is triggered from a <a href=\"#root/_help_OR8WJ7Iz9K4U\">hoisted note</a> or a <a href=\"#root/_help_9sRHySam5fXb\">workspace</a>.</li><li>To search the entire database, keep the value empty.</li></ol></li><li>To limit the search to only a few levels of hierarchy (e.g. look in sub-children but not in sub-sub-children of a note), set the <em>depth</em> field to one of the provided values.</li><li>In addition to that, the search can be configured via the <em>Add search option</em> menu, as described in the follow-up section.</li><li>Press <em>Search</em> (<span class=\"tn-icon bx bx-search\"></span>) to trigger the search. The results are displayed below the search configuration pane.</li><li>The <em>Search & Execute actions</em> (<span class=\"tn-icon bx bxs-zap\"></span>) entry in the menu beside <em>Search</em> is only relevant if at least one action has been added (as described in the section below).</li><li>The <em>Save to note</em> (<span class=\"tn-icon bx bx-save\"></span>) entry in the same menu will create a new note with the search configuration. For more information, see <a class=\"reference-link\" href=\"#root/_help_m523cpzocqaD\">Saved Search</a>.</li></ol><h2>Features</h2><h3>Autocomplete</h3><p>To help with the syntax, Trilium offers an autocomplete functionality which can be triggered by pressing <kbd>Ctrl</kbd>+<kbd>Space</kbd>.</p><p>Some suggestions also open on their own as you type: label and relation names after <code>#</code> and <code>~</code>, fields after <code>.</code>, operators, values, and notes after <code>@</code>. Keywords such as <code>and</code>, <code>or</code>, <code>not</code>, <code>orderBy</code> and <code>limit</code> appear only on <kbd>Ctrl</kbd>+<kbd>Space</kbd>, since a plain word is usually a search term.</p><p>No suggestion is selected when a list opens on its own, so <kbd>Enter</kbd> runs the search as typed. To insert a suggestion, select it with <kbd>Down</kbd> and press <kbd>Enter</kbd>. The list opened with <kbd>Ctrl</kbd>+<kbd>Space</kbd> and the notes after <code>@</code> open on the best match instead, so <kbd>Enter</kbd> inserts it.</p><p>The autocomplete offers:</p><ul><li>Basic operators such as <code>*=</code> and keywords (<code>limit</code>, <code>not</code>).</li><li>Fields for object-like fields such as <code>note</code> or <code>~relation</code>, triggered by typing <code>.</code>.</li><li>Contextual enumerations such as <code>note.type = \"</code> or <code>note.mime = \"</code>.</li><li><a href=\"#root/_help_HI6GBBIduIgv\">Label</a> names by typing <code>#</code>.<ul><li>A small gear on the name's icon indicates a system attribute.</li><li>After typing the label name, the value is also autocompleted with values that are present in the database.</li></ul></li><li><a href=\"#root/_help_Cq5X6iKQop6R\">Relation</a> names by typing <code>~</code>.</li><li><a href=\"#root/_help_m1lbrzyKDaRB\">Note ID</a>s can be inserted easily by typing <code>@</code> and looking for a note.<ul><li>If the note ID is under a valid syntax, it will be shown as a chip of the note instead of the raw ID.</li><li>This is especially useful for queries that make use of the note ID such as searching by template: <code>~template.noteId = @</code></li></ul></li></ul><h3>Syntax highlighting</h3><p>The search input features syntax highlighting, making recognized fields such as <code>note.</code> and operators like <code>NOT</code> stand out.</p><p>The same highlighting is available in <a class=\"reference-link\" href=\"#root/_help_6f9hih2hXXZk\">Code</a> notes, for example to keep a collection of queries: set the language of the note to <em>Trilium Search Query</em>. The language is not enabled by default; add it from <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> → <em>Code Notes</em> → <em>Available MIME types in the dropdown</em>.</p><h3>Error highlighting & linting</h3><p>The search is also checked for errors in two phases, which will be displayed as a red squiggle:</p><ul><li>Linter errors which identify common error patterns and also provide a way to fix them.</li><li>Search errors which are checked by the server, without indicating the exact place the error occurred.</li></ul><p>An error the search only runs into while running, such as an operator that note content cannot be searched with, is shown in a <em>Search error</em> card instead: below the search string, or at the top of the <a class=\"reference-link\" href=\"#root/_help_Ms1nauBra7gq\">Quick search</a> results.</p><h3>Multiline</h3><p>Long or complicated searches can be formatted by using newlines, similar to SQL queries. Newlines are treated just like spaces.</p><p>To add a new line, press <kbd>Shift</kbd>+<kbd>Enter</kbd>.</p><aside class=\"admonition note\"><p>Multiline is available only for the full search, other inputs such as the quick search or the collection filter are single line.</p></aside><h2>Search options</h2><p>Click <em>Add search option</em> to choose an option to apply.</p><ul><li>For each search option selected, the search configuration will update to reveal the entry. Each search option will have its own configuration.</li><li>To remove a search option, simply press the <span class=\"tn-icon bx bx-x\"></span> button to the right of it.</li></ul><p>The options available are:</p><ol><li><span class=\"tn-icon bx bx-code\"></span> Search script<ol><li>This feature allows writing a <a class=\"reference-link\" href=\"#root/_help_6f9hih2hXXZk\">Code</a> note that will handle the search on its own.</li></ol></li><li><span class=\"tn-icon bx bx-run\"></span> Fast search<ol><li>The search will not look into the content of the notes, but it will still look into note titles and attributes, relations (based on the search query).</li><li>This method can speed up the search considerably for large <a href=\"#root/_help_wX4HbRucYSDD\">databases</a>.</li></ol></li><li><span class=\"tn-icon bx bx-archive\"></span> Include archived<ol><li><a class=\"reference-link\" href=\"#root/_help_MKmLg5x6xkor\">Archived Notes</a> will also be included in the results, whereas otherwise they would be ignored.</li></ol></li><li><span class=\"tn-icon bx bx-arrow-from-top\"></span> Order by<ol><li>Allows changing the criteria for ordering the results, for example to order by creation date or alphabetically instead of by relevancy (default).</li><li>It's also possible to change the order (ascending or descending) of the results.</li></ol></li><li><span class=\"tn-icon bx bx-stop\"></span> Limit<ol><li>Limits the results to a given maximum.</li><li>This can help if the number of results would otherwise be high, at the cost of not being able to view all the results.</li></ol></li><li><span class=\"tn-icon bx bx-bug\"></span> Debug<ol><li>This will print additional information in the server log (see <a class=\"reference-link\" href=\"#root/_help_qzNzp9LYQyPT\">Error logs</a>), regarding how the search expression was parsed.</li><li>This function is especially useful after understanding the search functionality in detail, in order to determine why a complex search query is not working as expected.</li></ol></li></ol><p>The same menu ends with a <em>Bulk actions</em> section for applying changes such as adding a label or a relation to the matched notes. Its groups—<em>Labels</em>, <em>Relations</em>, <em>Notes</em> and <em>Other</em>—each open a list of the actions in the corresponding group of the <a class=\"reference-link\" href=\"#root/_help_ivYnonVFBxbQ\">Bulk Actions</a> dialog, which is an alternative for operating directly with notes within the <a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a>. Choosing one adds it to the search; unlike the other options, the same action can be added more than once (e.g. to apply multiple labels). After defining the actions, first press <em>Search</em> to check the matched notes and then choose <em>Search & Execute actions</em> from the menu beside it to trigger the actions.</p><h2>Viewing search results</h2><p>Results appear below the search pane, by default in the <em>Search preview</em> view. Each result is drawn as a <strong>snippet card</strong> with the note title, the path to it, a short excerpt of the matching text, and the attributes that matched. The excerpt of a code note keeps its indentation and is shown in the code font.</p><p>To show the results as a plain note list instead, choose <em>List</em> from the <a class=\"reference-link\" href=\"#root/_help_CssoWBu8I7jF\">Collection Properties</a> bar. The <em>List</em> view shows one row per note, with the note's title and content preview.</p><p>The search will also highlight the words from the title or content that matched:</p><ul><li>With a solid underlined green for a direct match;</li><li>With a dotted underline orange for a partial match (matched by the fuzzy search).</li></ul><p>In addition, the <em>Search preview</em> view offers:</p><ul><li>The <strong>total number of results</strong> is always shown, so you can immediately tell how broad a query is.</li><li>A <strong>page-size selector</strong> lets you choose how many results to display per page. Your choice is remembered and synced across your devices (stored in the <code>searchResultsPageSize</code> option), so you do not have to reset it on every device.</li><li><strong>Clicking a result's title</strong> opens the note and jumps straight to the first match. The in-note find bar opens pre-filled with the first word of your search, so you can step through its matches with the find controls. To have the find bar look for a whole phrase instead, put the phrase in quotes in the search, e.g. <code>\"The Lord of the Rings\"</code>. In read-only notes, the other words of the search are highlighted as well. The excerpt and attributes can be selected without opening the note.</li><li><em>Open all results in new tabs</em> (<span class=\"tn-icon bx bx-window-open\"></span>, the button above the results) opens every result in a tab of its own, up to 50. Each tab opens on its first match with the find bar pre-filled, as when clicking a result.</li><li>If a match is inside a <strong>collapsed section</strong> (for example a folded heading), that section is expanded automatically so the match is visible.</li><li>When the excerpt is cut short, a <em>Show more</em> button expands the card to the note's full content, with the search terms highlighted. <em>Show less</em> returns to the excerpt.</li></ul><p>A saved search can also be <a class=\"reference-link\" href=\"#root/_help_NRnIZmSMc5sj\">printed or exported as PDF</a> from the <em>Print/export to PDF…</em> item of the <a class=\"reference-link\" href=\"#root/_help_8YBEPzcpUgxw\">Note menu</a>, in either <em>Search preview</em> or <em>List</em> view. The results are laid out as a list, as they stand when printing starts.</p><h2>Simple Note Search Examples</h2><ul><li><code>rings tolkien</code>: Full-text search to find notes containing both \"rings\" and \"tolkien\".</li><li><code>\"The Lord of the Rings\" Tolkien</code>: Full-text search where \"The Lord of the Rings\" must match exactly.</li><li><code>note.content *=* rings OR note.content *=* tolkien</code>: Find notes containing \"rings\" or \"tolkien\" in their content.</li><li><code>towers #book</code>: Combine full-text and attribute search to find notes containing \"towers\" and having the \"book\" label. Writing <code>towers AND #book</code> does the same; to search for the word \"and\" itself, put it in quotes.</li><li><code>c#</code> or <code>towers#book</code>: A <code>#</code> or <code>~</code> inside a word is part of the text, so these find notes containing \"c#\" or \"towers#book\". To start a label or relation, put a space before it.</li><li><code>towers #book or #author</code>: Search for notes containing \"towers\" and having either the \"book\" or \"author\" label.</li><li><code>towers #!book</code>: Search for notes containing \"towers\" and not having the \"book\" label.</li><li><code>#book #publicationYear = 1954</code>: Find notes with the \"book\" label and \"publicationYear\" set to 1954.</li><li><code>#genre *=* fan</code>: Find notes with the \"genre\" label containing the substring \"fan\". Additional operators include <code>*=*</code> for \"contains\", <code>=*</code> for \"starts with\", <code>*=</code> for \"ends with\", and <code>!=</code> for \"is not equal to\".</li><li><code>#book #publicationYear >= 1950 #publicationYear < 1960</code>: Use numeric operators to find all books published in the 1950s.</li><li><code>#dateNote >= TODAY-30</code>: Find notes with the \"dateNote\" label within the last 30 days. Supported date values include NOW +- seconds, TODAY +- days, MONTH +- months, YEAR +- years.</li><li><code>~author.title *=* Tolkien</code>: Find notes related to an author whose title contains \"Tolkien\".</li><li><code>#publicationYear %= '19[0-9]{2}'</code>: Use the '%=' operator to match a regular expression (regex). This feature has been available since Trilium 0.52.</li><li><code>note.content %= '\\\\d{2}:\\\\d{2} (PM|AM)'</code>: Find notes that mention a time. Backslashes in a regex must be escaped.</li></ul><h2>Advanced Use Cases</h2><ul><li><code>~author.relations.son.title = 'Christopher Tolkien'</code>: Search for notes with an \"author\" relation to a note that has a \"son\" relation to \"Christopher Tolkien\". This can be modeled with the following note structure:<ul><li>Books<ul><li>Lord of the Rings<ul><li>label: “book”</li><li>relation: “author” points to “J. R. R. Tolkien” note</li></ul></li></ul></li><li>People<ul><li>J. R. R. Tolkien<ul><li>relation: “son” points to \"Christopher Tolkien\" note</li><li>Christopher Tolkien</li></ul></li></ul></li></ul></li><li><code>~author.title *= Tolkien OR (#publicationDate >= 1954 AND #publicationDate <= 1960)</code>: Use boolean expressions and parentheses to group expressions.</li><li><code>towers (#genre = fantasy OR #genre = scifi)</code>: A group can open the expression part directly, without a <code>#</code> or <code>~</code> before the parenthesis. Here it finds notes containing \"towers\" whose genre is fantasy or scifi.</li><li><code>note.parents.title = 'Books'</code>: Find notes with a parent named \"Books\".</li><li><code>note.parents.parents.title = 'Books'</code>: Find notes with a grandparent named \"Books\".</li><li><code>note.ancestors.title = 'Books'</code>: Find notes with an ancestor named \"Books\".</li><li><code>note.children.title = 'sub-note'</code>: Find notes with a child named \"sub-note\".</li><li><code>note.links.title = 'Tolkien'</code>: Find notes linking to a note named \"Tolkien\".</li><li><code>note.backlinks.title = 'Reading list'</code>: Find the notes that \"Reading list\" links to.</li><li>A link is a relation you created, such as <code>~author</code>, or one that content creates: an internal link (<code>~internalLink</code>), an image (<code>~imageLink</code>), an included note (<code>~includeNoteLink</code>) or a relation map connection (<code>~relationMapLink</code>). Relations that configure a note, such as <code>~template</code> or a saved search's <code>~ancestor</code>, are not links.</li></ul><p>See also <a class=\"reference-link\" href=\"#root/_help_Oxyb6jOjjVNL\">Under the hood</a> for more syntax references.</p><h3>Search with Note Properties</h3><p>Notes have properties that can be used in searches, such as <code>noteId</code>, <code>dateModified</code>, <code>dateCreated</code>, <code>isProtected</code>, <code>type</code>, <code>title</code>, <code>text</code>, <code>content</code>, <code>rawContent</code>, <code>ownedLabelCount</code>, <code>labelCount</code>, <code>ownedRelationCount</code>, <code>relationCount</code>, <code>ownedRelationCountIncludingLinks</code>, <code>relationCountIncludingLinks</code>, <code>ownedAttributeCount</code>, <code>attributeCount</code>, <code>targetRelationCount</code>, <code>targetRelationCountIncludingLinks</code>, <code>parentCount</code>, <code>childrenCount</code>, <code>isArchived</code>, <code>contentSize</code>, <code>noteSize</code>, and <code>revisionCount</code>.</p><p>These properties can be accessed via the <code>note.</code> prefix, e.g., <code>note.type = code AND note.mime = 'application/json'</code>.</p><h3>Order by and Limit</h3><pre><code class=\"language-text-x-trilium-auto\">#author=Tolkien orderBy #publicationDate desc, note.title limit 10</code></pre><p>This example will:</p><ol><li>Find notes with the author label \"Tolkien\".</li><li>Order the results by <code>publicationDate</code> in descending order.</li><li>Use <code>note.title</code> as a secondary ordering if publication dates are equal.</li><li>Limit the results to the first 10 notes.</li></ol><h3>Negation</h3><p>Some queries can only be expressed with negation:</p><pre><code class=\"language-text-x-trilium-auto\">#book AND not(note.ancestors.title = 'Tolkien')</code></pre><p>This query finds all book notes not in the \"Tolkien\" subtree.</p><h2>Under the Hood</h2><p>See the <a href=\"#root/_help_Oxyb6jOjjVNL\">dedicated page</a> to understand how progressive search works in Trilium, as well as some advanced use cases.</p><h2>Auto-Trigger Search from URL</h2><p>You can open Trilium and automatically trigger a search by including the search <a href=\"https://meyerweb.com/eric/tools/dencoder/\">url encoded</a> string in the URL:</p><p><code>http://localhost:8080/#?searchString=abc</code></p><h2>Search Configuration</h2><h3>Parameters</h3><figure class=\"table\"><table><thead><tr><th>Parameter</th><th>Value</th><th>Description</th></tr></thead><tbody><tr><td><code>MIN_FUZZY_TOKEN_LENGTH</code></td><td>3</td><td>Minimum characters the <code>~=</code> and <code>~*</code> operators accept</td></tr><tr><td><code>MAX_EDIT_DISTANCE</code></td><td>2</td><td>Ceiling on character changes, reached only by 7+ character terms; shorter terms allow fewer. See the <em>Fuzzy tolerance</em> section above</td></tr><tr><td><code>RESULT_SUFFICIENCY_THRESHOLD</code></td><td>5</td><td>Minimum exact results before fuzzy fallback</td></tr><tr><td><code>MAX_CONTENT_SIZE</code></td><td>10MB</td><td>Maximum note content size for search processing</td></tr></tbody></table></figure><h3>Limits</h3><ul><li>Searched note content is limited to 10MB per note to prevent performance issues</li><li>Notes exceeding this limit will still be included in title and attribute searches</li><li>Terms of 3 characters or fewer are matched exactly; typo tolerance starts at 4 characters</li></ul>","_help_Oxyb6jOjjVNL": "<h2>Progressive Search Strategy</h2><p>Trilium uses a progressive search strategy that performs exact matching first, then adds fuzzy matching when needed.</p><p>The search has three phases:</p><ol><li><strong>Phase 1 - Exact Matching</strong>: When you search, Trilium first looks for exact matches of your search terms. This handles the vast majority of searches (90%+) and returns results almost instantly.</li><li><strong>Phase 2 - Fuzzy Fallback</strong>: If Phase 1 doesn't find enough high-quality results (fewer than 5 results with good relevance scores), Trilium automatically adds fuzzy matching to find results with typos or spelling variations.</li><li><strong>Result Ordering</strong>: Exact matches always appear before fuzzy matches, regardless of individual scores. This ensures that when you search for \"project\", notes containing the exact word \"project\" will appear before notes containing similar words like \"projects\" or \"projection\".</li></ol><h3>Progressive Search Behavior</h3><ul><li><strong>Speed</strong>: Most searches complete using only exact matching</li><li><strong>Ordering</strong>: Exact matches appear before fuzzy matches</li><li><strong>Fallback</strong>: Fuzzy matching activates when exact matches return fewer than 5 results</li><li><strong>Identification</strong>: Results indicate whether they are exact or fuzzy matches</li></ul><h2>Search Performance</h2><p>Search system specifications:</p><ul><li>Content size limit: 10MB per note (previously 50KB)</li><li>Edit distance calculations for fuzzy matching</li><li>Infinite scrolling in Quick Search</li></ul><h2>Label and Relation Shortcuts</h2><p>The \"full\" syntax for searching by labels is:</p><pre><code class=\"language-text-x-trilium-auto\">note.labels.publicationYear = 1954</code></pre><p>For relations:</p><pre><code class=\"language-text-x-trilium-auto\">note.relations.author.title *=* Tolkien</code></pre><p>However, common label and relation searches have shortcut syntax:</p><pre><code class=\"language-text-x-trilium-auto\">#publicationYear = 1954\n~author.title *=* Tolkien</code></pre><h2>Separating Full-Text and Attribute Parts</h2><p>Search syntax allows combining full-text search with attribute-based search. For example, <code>tolkien #book</code> contains:</p><ol><li>Full-text tokens - <code>tolkien</code></li><li>Attribute expressions - <code>#book</code></li></ol><p>Trilium detects the separation between full text search and attribute/property search by looking for certain special characters or words that denote attributes and properties (e.g., #, ~, note.). If you need to include these in full-text search, escape them with a backslash so they are processed as regular text:</p><pre><code class=\"language-text-x-trilium-auto\">\"note.txt\" \n\\#hash \n#myLabel = 'Say \"Hello World\"'</code></pre><h2>Escaping Special Characters</h2><p>Special characters can be enclosed in quotes or escaped with a backslash to be used in full-text search:</p><pre><code class=\"language-text-x-trilium-auto\">\"note.txt\"\n\\#hash\n#myLabel = 'Say \"Hello World\"'</code></pre><p>Three types of quotes are supported: single, double, and backtick.</p><h2>Type Coercion</h2><p>Label values are technically strings but can be coerced for numeric comparisons:</p><pre><code class=\"language-text-x-trilium-auto\">note.dateCreated =* '2019-05'</code></pre><p>This finds notes created in May 2019. Numeric operators like <code>#publicationYear >= 1960</code> convert string values to numbers for comparison.</p>","_help_WbjlujkUhEb5": "<p>The single most common source of confusion is that the <code>=</code> sign means two <em>different</em> things depending on where it appears. Read this section once and the rest of search becomes predictable.</p><p>There are three matching modes:</p><figure class=\"table\"><table><thead><tr><th>Mode</th><th>How you trigger it</th><th>What it matches</th><th>Substring?</th><th>Fuzzy (typos)?</th></tr></thead><tbody><tr><td><strong>Default</strong></td><td>type words with no prefix</td><td>whole words <em>and</em> substrings, anywhere in title, content or attributes, relevance-ranked</td><td>Yes</td><td>Yes</td></tr><tr><td><strong>Exact full-text</strong></td><td>a leading <code>=</code> (e.g. <code>=sync</code>)</td><td>the exact whole word or phrase, ignoring surrounding punctuation</td><td>No</td><td>No</td></tr><tr><td><strong>Attribute / property equality</strong></td><td><code>=</code> inside a <code>#label=value</code> or <code>note.property=value</code> clause</td><td>the <em>entire</em> attribute or property value, exactly</td><td>No</td><td>No</td></tr></tbody></table></figure><h3>Default matching (no prefix)</h3><p><strong>Rule:</strong> typing words with no prefix finds notes that contain those words anywhere in the title, content or attributes, as whole words or as substrings. The closest matches are ranked first.</p><figure class=\"table\"><table><thead><tr><th>Query</th><th>Example note content</th><th>Matches?</th><th>Why</th></tr></thead><tbody><tr><td><code>sync</code></td><td><code>please sync the folders</code></td><td>Yes (ranked higher)</td><td>contains the exact word <code>sync</code></td></tr><tr><td><code>sync</code></td><td><code>synchronize the database now</code></td><td>Yes (ranked lower)</td><td><code>sync</code> is a substring of <code>synchronize</code></td></tr></tbody></table></figure><h3>Exact match with the <code>=</code> prefix</h3><p><strong>Rule:</strong> a leading <code>=</code> switches the full-text search to exact matching. It finds the whole word or phrase only, ignoring surrounding punctuation, with <strong>no</strong> substring and <strong>no</strong> fuzzy matching. Use it when a normal search returns too many near-matches.</p><figure class=\"table\"><table><thead><tr><th>Query</th><th>Example note content</th><th>Matches?</th><th>Why</th></tr></thead><tbody><tr><td><code>=sync</code></td><td><code>see (sync) mode</code></td><td>Yes</td><td><code>(sync)</code> is the whole word <code>sync</code>; punctuation is ignored</td></tr><tr><td><code>=sync</code></td><td><code>in sync, then continue</code></td><td>Yes</td><td><code>sync,</code> is the whole word <code>sync</code></td></tr><tr><td><code>=sync</code></td><td><code>he said \"sync\" out loud</code></td><td>Yes</td><td><code>\"sync\"</code> is the whole word <code>sync</code></td></tr><tr><td><code>=sync</code></td><td><code>synchronize the database now</code></td><td>No</td><td><code>=</code> never matches substrings</td></tr><tr><td><code>=sync</code></td><td><code>please send the file</code></td><td>No</td><td><code>=</code> never matches typos / fuzzy</td></tr></tbody></table></figure><p>To match an exact <strong>phrase</strong>, quote it after the <code>=</code> (single, double or backtick quotes all work). The phrase must appear as consecutive words, but punctuation between or around them is ignored:</p><figure class=\"table\"><table><thead><tr><th>Query</th><th>Example note (title or content)</th><th>Matches?</th><th>Why</th></tr></thead><tbody><tr><td><code>=\"project plan\"</code></td><td>title <code>Project Plan</code></td><td>Yes</td><td>the title is exactly the phrase</td></tr><tr><td><code>=\"project plan\"</code></td><td><code>the (project plan) is ready to share</code></td><td>Yes</td><td>the consecutive phrase appears; punctuation is ignored</td></tr><tr><td><code>=\"project plan\"</code></td><td><code>the plan for this project is late</code></td><td>No</td><td>the words are present but not consecutive</td></tr></tbody></table></figure><h3>Attribute and property equality (<code>=</code>, <code>!=</code>)</h3><p><strong>Rule:</strong> when <code>=</code> compares an attribute or property, as in <code>#label=value</code> or <code>note.title=value</code>, it is <strong>strict full-value equality</strong>: the <em>whole</em> value must equal what you typed, ignoring case and diacritics. This is <strong>not</strong> word matching. <code>!=</code> inverts it.</p><p>The examples below assume four notes: <em>Austria</em> (<code>#capital=Vienna</code>), <em>Somewhere</em> (<code>#capital=Vienna Austria</code>), <em>Czech Republic</em> (<code>#capital=Prague</code>) and <em>Switzerland</em> (<code>#capital=Zürich</code>).</p><figure class=\"table\"><table><thead><tr><th>Query</th><th>Example label value</th><th>Matches?</th><th>Why</th></tr></thead><tbody><tr><td><code>#capital=Vienna</code></td><td><code>Vienna</code></td><td>Yes</td><td>the whole value equals <code>Vienna</code></td></tr><tr><td><code>#capital=Vienna</code></td><td><code>Vienna Austria</code></td><td>No</td><td>the whole value is <code>Vienna Austria</code>, not <code>Vienna</code></td></tr><tr><td><code>#capital=\"Vienna Austria\"</code></td><td><code>Vienna Austria</code></td><td>Yes</td><td>quote a multi-word value to match it in full</td></tr><tr><td><code>#capital=Zurich</code></td><td><code>Zürich</code></td><td>Yes</td><td>equality ignores diacritics</td></tr><tr><td><code>#capital!=Vienna</code></td><td><code>Prague</code></td><td>Yes</td><td><code>!=</code> matches every value that is not <code>Vienna</code></td></tr><tr><td><code>#capital!=Vienna</code></td><td><code>Vienna</code></td><td>No</td><td><code>!=</code> excludes the exact value</td></tr></tbody></table></figure><blockquote><p><strong>Quick search relaxes this.</strong> The <a href=\"#root/_help_Ms1nauBra7gq\">Quick search</a> bar and autocomplete treat an attribute <code>=</code> as \"contains\", so <code>#capital=Vienna</code> typed there also matches <code>Vienna Austria</code>. The strict full-value equality described here applies only in the full Search.</p></blockquote><h3>Fuzzy operators (<code>~=</code> and <code>~*</code>)</h3><p><strong>Rule:</strong> the fuzzy operators tolerate typos. <code>~=</code> (fuzzy-equals) matches a value that is a close whole-word variant of your term. <code>~*</code> (fuzzy-contains) matches when your term appears anywhere inside the value, either as a fragment or as a near-miss. Both work on note properties such as <code>note.title</code> and <code>note.content</code>, and on labels (<code>#label</code>). Fuzzy operators accept terms of at least 3 characters, though how many typos each term tolerates depends on its length — see <em>Fuzzy tolerance</em> below.</p><p>The examples assume a note titled <code>Books</code> carrying the label <code>#author=Tolkien</code>, and a note whose content is <code>learn programming today</code>.</p><figure class=\"table\"><table><thead><tr><th>Query</th><th>Example value</th><th>Matches?</th><th>Why</th></tr></thead><tbody><tr><td><code>note.title ~= boks</code></td><td>title <code>Books</code></td><td>Yes</td><td>one edit away from <code>books</code></td></tr><tr><td><code>#author ~= tolkein</code></td><td>author <code>Tolkien</code></td><td>Yes</td><td><code>tolkein</code> is a typo of <code>tolkien</code></td></tr><tr><td><code>note.content ~* progr</code></td><td><code>learn programming today</code></td><td>Yes</td><td><code>progr</code> is a fragment of <code>programming</code></td></tr><tr><td><code>note.content ~* programing</code></td><td><code>learn programming today</code></td><td>Yes</td><td><code>programing</code> is one edit from <code>programming</code></td></tr></tbody></table></figure><h3>Fuzzy tolerance</h3><p><strong>Rule:</strong> how many typos are tolerated depends on the <strong>length</strong> of your search term. Short terms must match exactly, because a single edit is enough to turn one short word into an unrelated one; longer terms have greater tolerance.</p><figure class=\"table\"><table><thead><tr><th>Term length</th><th>Edits allowed</th></tr></thead><tbody><tr><td>1–3 characters</td><td>0 (exact only)</td></tr><tr><td>4–6 characters</td><td>1</td></tr><tr><td>7+ characters</td><td>2</td></tr></tbody></table></figure><figure class=\"table\"><table><thead><tr><th>Query</th><th>Term length</th><th>Example note content</th><th>Matches?</th><th>Why</th></tr></thead><tbody><tr><td><code>cat</code></td><td>3</td><td><code>a bright red car</code></td><td>No</td><td>No edits are allowed below 4 characters, so <code>cat</code> does not reach <code>car</code></td></tr><tr><td><code>carr</code></td><td>4</td><td><code>a blue debit card</code></td><td>Yes</td><td>1 edit is within budget for 4–6 character terms</td></tr><tr><td><code>ceck</code></td><td>4</td><td><code>the latest tech trends</code></td><td>No</td><td><code>ceck</code>→<code>tech</code> needs 2 edits; only 1 is allowed at this length</td></tr><tr><td><code>combinef</code></td><td>8</td><td><code>the values were combined together</code></td><td>Yes</td><td><code>combinef</code>→<code>combined</code> is 1 edit; up to 2 are allowed at 7+ characters</td></tr></tbody></table></figure><h3>Relevance ranking</h3><p><strong>Rule:</strong> results are ordered by <em>how well</em> they match, not merely whether they match. Exact whole-word and phrase matches rank above substring and fuzzy matches, and a note where your words appear as a consecutive phrase outranks one where they are scattered.</p><figure class=\"table\"><table><thead><tr><th>Query</th><th>Ranked higher</th><th>Ranked lower</th><th>Why</th></tr></thead><tbody><tr><td><code>sync</code></td><td><code>please sync the folders</code></td><td><code>synchronize the database now</code></td><td>exact word beats substring</td></tr><tr><td><code>you and me</code></td><td><code>I like you and me as a phrase</code></td><td><code>the menu is here and you know it</code></td><td>consecutive phrase beats scattered words</td></tr></tbody></table></figure><h3>What is searchable</h3><p>A search looks at more than the visible body text. All of the following are indexed and searchable:</p><ul><li>note titles,</li><li>note body content,</li><li>labels and relations (<a href=\"#root/_help_zEY4DaJG4YT5\">attributes</a>),</li><li>link URLs and the titles/descriptions of link previews,</li><li>the titles of notes that a note reference-links to.</li></ul><p>The last point is the least obvious: if a note's only content is a reference link to another note, searching for that other note's <strong>title</strong> still finds the linking note.</p><figure class=\"table\"><table><thead><tr><th>Query</th><th>Setup</th><th>Matches?</th><th>Why</th></tr></thead><tbody><tr><td><code>special topic</code></td><td>a note whose only content is a reference link to a note titled <code>Special Topic</code></td><td>Yes, and the linked target ranks first</td><td>the target's title is indexed into the linking note's searchable text</td></tr><tr><td><code>special</code></td><td>the same note (only a reference link to <code>Special Topic</code>)</td><td>Yes, one word from the target's title is enough</td><td>the indexed title is normalized just like body text, so even one lowercased word matches</td></tr><tr><td><code>zurich</code></td><td>a note whose only content is a reference link to a note titled <code>Zürich</code></td><td>Yes</td><td>the indexed title has its accents normalized, so the plain form matches the accented title</td></tr></tbody></table></figure><h3>Diacritics</h3><p><strong>Rule:</strong> accents are normalized on both sides, so an accented word and its plain form match each other.</p><figure class=\"table\"><table><thead><tr><th>Query</th><th>Example note content</th><th>Matches?</th></tr></thead><tbody><tr><td><code>ktory</code></td><td><code>slovo ktorý znamena nieco</code></td><td>Yes</td></tr><tr><td><code>ktorý</code></td><td><code>the word ktory appears here</code></td><td>Yes</td></tr></tbody></table></figure><h3>Regular expressions (<code>%=</code>)</h3><p><strong>Rule:</strong> the <code>%=</code> operator matches a property or label value against a regular expression.</p><figure class=\"table\"><table><thead><tr><th>Query</th><th>Example note content</th><th>Matches?</th></tr></thead><tbody><tr><td><code>note.content %= 'colou?r'</code></td><td><code>my favorite color of all</code></td><td>Yes</td></tr><tr><td><code>note.content %= 'colou?r'</code></td><td><code>my favourite colour of all</code></td><td>Yes</td></tr></tbody></table></figure>",- "_help_u3YFHC9tQlpm": "<p>Frequently used notes can be bookmarked, which will make them appear in the <a class=\"reference-link\" href=\"#root/_help_xYmIYSP6wE3F\">Launch Bar</a> for easy access.</p><h2>Configuring the launch bar</h2><p>If bookmarks don't appear in the launch bar, then most likely the bookmark section has been hidden. Go to the <a class=\"reference-link\" href=\"#root/_help_xYmIYSP6wE3F\">Launch Bar</a> configuration from the <a class=\"reference-link\" href=\"#root/_help_x3i7MxGccDuM\">Global menu</a> and ensure <em>Bookmarks</em> is in the <em>Visible Launchers</em> section.</p><h2>Bookmark folder</h2><p>Space in the left panel is limited, and you might want to bookmark many items. One possible solution is to bookmark a folder, so it shows its children:</p><p>To do this, bookmark a folder, then right click its button in the <a class=\"reference-link\" href=\"#root/_help_xYmIYSP6wE3F\">Launch Bar</a> and check <em>Show as a folder</em>. The button then opens a list of the note's children instead of the note itself. Uncheck <em>Show as a folder</em> to turn it back into a regular bookmark.</p><p><em>Show as a folder</em> assigns the <code>#bookmarkFolder</code> label to the note, so adding the label by hand works as well. Because the label belongs to the note, a note that is both bookmarked and dropped onto the launch bar shows its children in both places.</p><h2>Mobile</h2><p>On mobile, bookmarks are only displayed starting with v0.102.0. Because of the more constrained screen size, the bookmarks are grouped under a single icon instead of displaying them as separate icons.</p><p>When pressed, a menu will appear listing all the bookmarks. Bookmark folders are also supported and will appear as sub-menus.</p>",+ "_help_u3YFHC9tQlpm": "<p>Frequently used notes can be bookmarked, which will make them appear in the <a class=\"reference-link\" href=\"#root/_help_xYmIYSP6wE3F\">Launch Bar</a> for easy access.</p><h2>Configuring the launch bar</h2><p>If bookmarks don't appear in the launch bar, then most likely the bookmark section has been hidden. Go to the <a class=\"reference-link\" href=\"#root/_help_xYmIYSP6wE3F\">Launch Bar</a> configuration from the <a class=\"reference-link\" href=\"#root/_help_x3i7MxGccDuM\">Global menu</a> and ensure <em>Bookmarks</em> is in the <em>Visible Launchers</em> section.</p><h2>Bookmark folder</h2><p>Space in the left panel is limited, and you might want to bookmark many items. One possible solution is to bookmark a folder, so it shows its children:</p><p>To do this, bookmark a folder, then right click its button in the <a class=\"reference-link\" href=\"#root/_help_xYmIYSP6wE3F\">Launch Bar</a> and check <em>Show as a folder</em>. The button then opens a menu instead of the note itself: the note is at the top, followed by its children. Uncheck <em>Show as a folder</em> to turn it back into a regular bookmark.</p><p>A child that has children of its own shows an arrow at the end of its row. Click the arrow to list its children in a submenu, or click the rest of the row to open the note. Submenus nest up to four levels deep. A menu that lists more than 15 children shows a filter field above them: type part of a title to list only the notes that match. A note whose subtree is hidden (see <a class=\"reference-link\" href=\"#root/_help_wyaGBBQrl4i3\">Hiding the subtree</a>) doesn't list its children here either.</p><p><em>Show as a folder</em> assigns the <code>#bookmarkFolder</code> label to the note, so adding the label by hand works as well. Because the label belongs to the note, a note that is both bookmarked and dropped onto the launch bar shows its children in both places.</p><h2>Mobile</h2><p>On mobile, bookmarks are only displayed starting with v0.102.0. Because of the more constrained screen size, the bookmarks are grouped under a single icon instead of displaying them as separate icons.</p><p>When pressed, a menu will appear listing all the bookmarks. Bookmark folders are also supported and will appear as submenus. Each submenu starts with its own note, so a note with children can be opened as well as browsed.</p>","_help_OR8WJ7Iz9K4U": "<p>Hoisting is a standard outliner feature which allows you to focus on (or \"zoom into\") a specific note and its subtree by hiding all parent and sibling notes. Demo:</p><p><img src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/Navigation/Note%20Hoisting_note-hoisting.gif\"></p><p>In addition to showing only this subtree, this also narrows both full text search and <a href=\"#root/_help_MMiBEQljMQh2\">“jump to note”</a> to just notes present in hoisted subtree.</p><h2>Showing all notes again</h2><p>While a note is hoisted, the desktop interface shows a <em>Show all notes</em> button with the <span class=\"tn-icon bx bx-arrow-back\"></span> icon above the <a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a>. Click it to unhoist the note and see the whole tree again.</p><p>See also <a href=\"#root/_help_9sRHySam5fXb\">Workspace</a> which extends this feature.</p>","_help_ZjLYv08Rp3qC": "<figure class=\"image image-style-align-right image_resized\" style=\"width:53.13%;\"><img style=\"aspect-ratio:895/694;\" src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/Navigation/Quick%20edit_image.png\" width=\"895\" height=\"694\"></figure><p><em>Quick edit</em> provides an alternative to the standard tab-based navigation and editing.</p><p>Instead of clicking on a note which switches the <a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a> to the newly selected note, or navigating between two different <a class=\"reference-link\" href=\"#root/_help_3seOhtN8uLIY\">Tabs</a>, the <em>Quick edit</em> feature opens as a popup window that can be easily dismissed.</p><p>This feature is also well integrated with <a class=\"reference-link\" href=\"#root/_help_GTwFsgaA0lCt\">Collections</a> such as the calendar view, which makes it easy to edit entries without having to go back and forth between the child note and the calendar.</p><h2>Feature highlights</h2><ul><li>All note types are supported, including <a class=\"reference-link\" href=\"#root/_help_GTwFsgaA0lCt\">Collections</a>.</li><li>Note that the <a class=\"reference-link\" href=\"#root/_help_0ESUbbAxVnoK\">Note List</a> will not be displayed, except for notes of type <a class=\"reference-link\" href=\"#root/_help_GTwFsgaA0lCt\">Collections</a>.</li><li>For <a class=\"reference-link\" href=\"#root/_help_iPIMuisry3hd\">Text</a> notes, depending on user preference, both the floating and classic editors are supported. See <a class=\"reference-link\" href=\"#root/_help_nRhnJkTT8cPs\">Formatting toolbar</a>.</li><li>The title and the note and the icon are editable, just like a normal tab.</li><li>The note's actions and its menu are shown in the header of the popup, as in the title row of a tab.<ul><li>When other notes link to the note, a button with a link icon lists the <a class=\"reference-link\" href=\"#root/_help_wfGXLmm7x27z\">Backlinks</a>. Pressing one opens that note in the popup.</li><li>The menu items that only work in a tab are not shown: <em>Note map</em>, <em>Full width</em> and <em>Convert into attachment</em>.</li><li><em>Find</em> in the menu, or <kbd>Ctrl</kbd>+<kbd>F</kbd> on the desktop application, opens the <a class=\"reference-link\" href=\"#root/_help_McngOG2jbUWX\">Search in note</a> bar at the bottom of the popup. It searches the note in the popup, not the note in the tab behind it.</li><li>A help page opened from the popup, such as through the help button of the note type, opens in a second popup on top of it. Closing that popup returns to the note being edited.</li></ul></li><li>The <a class=\"reference-link\" href=\"#root/_help_OFXdgB2nNk1F\">Promoted Attributes</a> are also displayed.<ul><li>This integrates well with <a class=\"reference-link\" href=\"#root/_help_GTwFsgaA0lCt\">Collections</a> where there are predefined attributes such as the <em>Start date</em> and <em>End date</em>, allowing for easy editing.</li></ul></li></ul><h2>Accessing the quick edit</h2><ul><li>From the <a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a>:<ul><li>Right click on a note and select <em>Quick edit</em>.</li><li>or, press <kbd>Ctrl</kbd>+<kbd>Right click</kbd> on a note.</li></ul></li><li>On <a class=\"reference-link\" href=\"#root/_help_hrZ1D00cLbal\">Internal (reference) links</a>: <ul><li>Right click and select <em>Quick edit</em>.</li><li>or, press <kbd>Ctrl</kbd>+<kbd>Right click</kbd> on the link.</li></ul></li><li>On a <a class=\"reference-link\" href=\"#root/_help_lgKX7r3aL30x\">Note Tooltip</a>, press the quick edit icon.</li><li>In <a class=\"reference-link\" href=\"#root/_help_GTwFsgaA0lCt\">Collections</a>:<ul><li>For <a class=\"reference-link\" href=\"#root/_help_xWbu3jpNWapp\">Calendar</a>:<ul><li>Clicking on an event will open that event for quick editing.</li><li>If the calendar is for the <a class=\"reference-link\" href=\"#root/_help_l0tKav7yLHGF\">Day Notes</a> root, clicking on the day number will open the popup for that day note.</li></ul></li><li>For <a class=\"reference-link\" href=\"#root/_help_81SGnPGMk7Xc\">Geo Map</a>:<ul><li>Clicking on a marker will open that marker, but only if the map is in read-only mode.</li></ul></li></ul></li></ul><h2>Handling of read-only notes</h2><p>The Quick edit feature has a unique behavior for <a class=\"reference-link\" href=\"#root/_help_CoFPLs3dRlXc\">Read-Only Notes</a>: </p><ul><li>If the note is read-only due to performance reasons (auto read-only), then the note is made editable for quick editing.</li><li>If the note has been manually set to read-only, then the note is read-only to prevent accidental change.<ul><li>In this case, the note can still be edited by on-screen instructions.</li></ul></li></ul><h2>Mobile support</h2><p>On a phone, the popup uses the full width of the screen and the note's content keeps the same side margin as a <a class=\"reference-link\" href=\"#root/_help_iPIMuisry3hd\">Text</a> note. The <a class=\"reference-link\" href=\"#root/_help_nRhnJkTT8cPs\">Formatting toolbar</a> of a text note sits at the foot of the dialog, below the note; its dropdowns open upwards so the keyboard does not cover them.</p>","_help_9sRHySam5fXb": "<p>Workspace is a concept built up on top of <a href=\"#root/_help_OR8WJ7Iz9K4U\">note hoisting</a>. It is based on the idea that a user has several distinct spheres of interest. An example might be \"Personal\" and \"Work\", these two spheres are quite distinct and don't interact together. When I focus on Work, I don't really care about personal notes.</p><p>So far workspace consists of these features:</p><ul><li><p><a href=\"#root/_help_OR8WJ7Iz9K4U\">note hoisting</a> - you can \"zoom\" into a workspace subtree to focus only on the relevant notes</p></li><li><p>easy entering of workspace: </p><p><img src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/Navigation/1_Workspaces_image.jpg\"></p></li><li><p>opening a workspace in a new tab: right-click the <span class=\"tn-icon bx bx-plus\"></span> button of the <a class=\"reference-link\" href=\"#root/_help_3seOhtN8uLIY\">Tabs</a> bar and select the workspace.</p></li><li><p>visual identification of workspace in tabs:<br><img src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/Navigation/Workspaces_image.jpg\"></p></li></ul><h3>Configuration</h3><figure class=\"table\"><table><thead><tr><th>Label</th><th>Description</th></tr></thead><tbody><tr><td><code>workspace</code></td><td>Marks this note as a workspace, button to enter the workspace is controlled by this</td></tr><tr><td><code>workspaceIconClass</code></td><td>defines box icon CSS class which will be used in tab when hoisted to this note, and in the menu of the tab bar's <span class=\"tn-icon bx bx-plus\"></span> button</td></tr><tr><td><code>workspaceTabBackgroundColor</code></td><td>CSS color used in the note tab when hoisted to this note, and for the workspace's icon in the menu of the tab bar's <span class=\"tn-icon bx bx-plus\"></span> button, use any CSS color format, e.g. \"lightblue\" or \"#ddd\". See <a href=\"https://www.w3schools.com/cssref/css_colors.asp\">https://www.w3schools.com/cssref/css_colors.asp</a>.</td></tr><tr><td><code>workspaceCalendarRoot</code></td><td>Marking a note with this label will define a new per-workspace calendar for <a class=\"reference-link\" href=\"#root/_help_l0tKav7yLHGF\">Day Notes</a>. If there's no such note, the global calendar will be used.</td></tr><tr><td><code>workspaceTemplate</code></td><td>This note will appear in the selection of available template when creating new note, but only when hoisted into a workspace containing this template</td></tr><tr><td><code>workspaceSearchHome</code></td><td>new search notes will be created as children of this note when hoisted to some ancestor of this workspace note</td></tr><tr><td><code>workspaceInbox</code></td><td>Default inbox location for new notes when hoisted to some ancestor of this workspace note. See <a class=\"reference-link\" href=\"#root/_help_S0Fos78ZfcY7\">Note Inbox</a> for more information.</td></tr></tbody></table></figure>",diff --git a/docs/User Guide/User Guide/Basic Concepts and Features/Navigation/Bookmarks.md b/docs/User Guide/User Guide/Basic Concepts and Features/Navigation/Bookmarks.mdindex 4e0baf60bc..6317f063ed 100644--- a/docs/User Guide/User Guide/Basic Concepts and Features/Navigation/Bookmarks.md+++ b/docs/User Guide/User Guide/Basic Concepts and Features/Navigation/Bookmarks.md@@ -9,7 +9,9 @@ If bookmarks don't appear in the launch bar, then most likely the bookmark sectiSpace in the left panel is limited, and you might want to bookmark many items. One possible solution is to bookmark a folder, so it shows its children:-To do this, bookmark a folder, then right click its button in the <a class="reference-link" href="../UI%20Elements/Launch%20Bar.md">Launch Bar</a> and check _Show as a folder_. The button then opens a list of the note's children instead of the note itself. Uncheck _Show as a folder_ to turn it back into a regular bookmark.+To do this, bookmark a folder, then right click its button in the <a class="reference-link" href="../UI%20Elements/Launch%20Bar.md">Launch Bar</a> and check _Show as a folder_. The button then opens a menu instead of the note itself: the note is at the top, followed by its children. Uncheck _Show as a folder_ to turn it back into a regular bookmark.++A child that has children of its own shows an arrow at the end of its row. Click the arrow to list its children in a submenu, or click the rest of the row to open the note. Submenus nest up to four levels deep. A menu that lists more than 15 children shows a filter field above them: type part of a title to list only the notes that match. A note whose subtree is hidden (see <a class="reference-link" href="../UI%20Elements/Note%20Tree/Hiding%20the%20subtree.md">Hiding the subtree</a>) doesn't list its children here either._Show as a folder_ assigns the `#bookmarkFolder` label to the note, so adding the label by hand works as well. Because the label belongs to the note, a note that is both bookmarked and dropped onto the launch bar shows its children in both places.@@ -17,4 +19,4 @@ _Show as a folder_ assigns the `#bookmarkFolder` label to the note, so adding thOn mobile, bookmarks are only displayed starting with v0.102.0. Because of the more constrained screen size, the bookmarks are grouped under a single icon instead of displaying them as separate icons.-When pressed, a menu will appear listing all the bookmarks. Bookmark folders are also supported and will appear as sub-menus.\ No newline at end of file+When pressed, a menu will appear listing all the bookmarks. Bookmark folders are also supported and will appear as submenus. Each submenu starts with its own note, so a note with children can be opened as well as browsed.\ No newline at end of file