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/ui/card: relocate ItemCreationRow component
Adorian Doran1c79d46bdb74
diff --git a/apps/client/src/widgets/react/Card.css b/apps/client/src/widgets/react/Card.cssindex 83f4fb8ab6..c2436467f1 100644--- a/apps/client/src/widgets/react/Card.css+++ b/apps/client/src/widgets/react/Card.css@@ -378,6 +378,62 @@ body[dir=rtl] .tn-card-option::after {background-color: color-mix(in srgb, var(--card-background-color) calc(100% / (var(--tn-card-section-nesting-level) + 1)) , transparent);}}++ /* Transparent: each button paints itself, and the gaps show the card through. */+ .tn-card-section.tn-card-adders {+ display: flex;+ gap: var(--card-section-gap);+ border: none;+ padding: 0;+ background: transparent;+ }++ /* Painted as a segment rather than a button, all of one width, undoing what Bootstrap and the+ theme give a button. */+ .tn-card-adders > button.tn-card-adder.btn {+ display: flex;+ flex: 1 1 0;+ justify-content: center;+ align-items: center;+ gap: .3em;+ min-width: 0;+ box-shadow: none;+ border: 1px solid var(--card-border-color, var(--main-border-color));+ border-radius: 0;+ padding: var(--card-padding-block) var(--card-padding-inline);+ background: var(--card-background-color);+ color: var(--muted-text-color);+ font: inherit;+ letter-spacing: normal;+ text-transform: none;+ cursor: pointer;++ &:hover {+ background-color: var(--card-background-hover-color);+ color: var(--main-text-color);+ }++ &:active {+ background-color: var(--card-background-hover-color);+ }+ }++ /* The row is transparent, so its buttons carry the card's corners. */+ .tn-card-adders:first-of-type > button.tn-card-adder:first-child {+ border-start-start-radius: var(--card-border-radius);+ }++ .tn-card-adders:first-of-type > button.tn-card-adder:last-child {+ border-start-end-radius: var(--card-border-radius);+ }++ .tn-card-adders:last-of-type > button.tn-card-adder:first-child {+ border-end-start-radius: var(--card-border-radius);+ }++ .tn-card-adders:last-of-type > button.tn-card-adder:last-child {+ border-end-end-radius: var(--card-border-radius);+ }}/* A card the filter did not ask for by name is left with what matched and what accompanies it:diff --git a/apps/client/src/widgets/react/Card.tsx b/apps/client/src/widgets/react/Card.tsxindex bf2e28b2a7..c8fdf2e22a 100644--- a/apps/client/src/widgets/react/Card.tsx+++ b/apps/client/src/widgets/react/Card.tsx@@ -1,13 +1,15 @@import "./Card.css";import { cloneElement, ComponentChildren, createContext, isValidElement } from "preact";-import { JSX, HTMLAttributes } from "preact";+import { JSX, HTMLAttributes, type RefObject } from "preact";import { useCallback, useContext, useLayoutEffect, useRef, useState } from "preact/hooks";import clsx from "clsx";+import Button from "./Button";import {type FilterRole, FilterPassthrough, filterRoleClass, useFilterMatch, useIsFiltering} from "./filter";import { useUniqueName } from "./hooks";+import Icon from "./Icon";// #region Card Frame@@ -266,4 +268,55 @@ function holdsSmallControl(element: HTMLElement) {return false;}+// #endregion++// #region Item Creation Row++/** One button of an {@link ItemCreationRow}. */+export interface ItemCreationRowButton {+ label: string;+ /** An icon class, `bx` prefix included. */+ icon?: string;+ /** Turns the button off, for a caller that cannot make an entry yet. */+ disabled?: boolean;+ /** The button's `name` attribute, which tests find it by. */+ name?: string;+ onClick: (event: MouseEvent) => void;+}++interface ItemCreationRowProps {+ buttons: ItemCreationRowButton[];+ elementRef?: RefObject<HTMLElement | null>;+ onKeyDown?: (event: KeyboardEvent) => void;+}++/**+ * The buttons that create an entry, as the last section of a card. Each is painted as a segment of+ * the card rather than as a button, so the row reads as the foot of the list above it.+ */+export function ItemCreationRow({ buttons, elementRef, onKeyDown }: ItemCreationRowProps) {+ return (+ // Transparent: each button paints itself, and the gaps show the card through.+ <section ref={elementRef} className="tn-card-section tn-card-adders" onKeyDown={onKeyDown}>+ {buttons.map((button, index) => (+ <Button+ // The position in the row: two buttons can share a label.+ key={index}+ name={button.name}+ // Not a command button: the theme gives those a background, a shadow and a+ // minimum width, none of which suit a segment.+ kind="lowProfile"+ className="tn-card-adder"+ text={<>+ {button.icon && <Icon icon={button.icon} />}+ <span>{button.label}</span>+ </>}+ disabled={button.disabled}+ onClick={button.onClick}+ />+ ))}+ </section>+ );+}+// #endregion\ No newline at end of filediff --git a/apps/client/src/widgets/react/SortableCard.css b/apps/client/src/widgets/react/SortableCard.cssindex c7b6f340be..25ecca3d40 100644--- a/apps/client/src/widgets/react/SortableCard.css+++ b/apps/client/src/widgets/react/SortableCard.css@@ -119,64 +119,6 @@}}-.tn-card {- /* Transparent: each button paints itself, and the gaps show the card through. */- .tn-card-section.tn-card-adders {- display: flex;- gap: var(--card-section-gap);- border: none;- padding: 0;- background: transparent;- }-- /* Painted as a segment rather than a button, all of one width, undoing what Bootstrap and the- theme give a button. */- .tn-card-adders > button.tn-card-adder.btn {- display: flex;- flex: 1 1 0;- justify-content: center;- align-items: center;- gap: 0.3em;- min-width: 0;- box-shadow: none;- border: 1px solid var(--card-border-color, var(--main-border-color));- border-radius: 0;- padding: var(--card-padding-block) var(--card-padding-inline);- background: var(--card-background-color);- color: var(--muted-text-color);- font: inherit;- letter-spacing: normal;- text-transform: none;- cursor: pointer;-- &:hover {- background-color: var(--card-background-hover-color);- color: var(--main-text-color);- }-- &:active {- background-color: var(--card-background-hover-color);- }- }-- /* The row is transparent, so its buttons carry the card's corners. */- .tn-card-adders:first-of-type > button.tn-card-adder:first-child {- border-start-start-radius: var(--card-border-radius);- }-- .tn-card-adders:first-of-type > button.tn-card-adder:last-child {- border-start-end-radius: var(--card-border-radius);- }-- .tn-card-adders:last-of-type > button.tn-card-adder:first-child {- border-end-start-radius: var(--card-border-radius);- }-- .tn-card-adders:last-of-type > button.tn-card-adder:last-child {- border-end-end-radius: var(--card-border-radius);- }-}-@keyframes tn-sortable-appear {from { opacity: 0; }to { opacity: 1; }diff --git a/apps/client/src/widgets/react/SortableCard.tsx b/apps/client/src/widgets/react/SortableCard.tsxindex 8b95932a04..d05f5f8dec 100644--- a/apps/client/src/widgets/react/SortableCard.tsx+++ b/apps/client/src/widgets/react/SortableCard.tsx@@ -1,15 +1,14 @@import "./SortableCard.css";import clsx from "clsx";-import { ComponentChildren, type RefObject } from "preact";+import { ComponentChildren } from "preact";import { flushSync } from "preact/compat";import {useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState} from "preact/hooks";import { t } from "../../services/i18n";-import Button from "./Button";-import { Card, type CardProps } from "./Card";+import { Card, type CardProps, ItemCreationRow, type ItemCreationRowButton } from "./Card";import { createEdgeScroller, type Insets, type ScrollTarget } from "./edge_scroll";import { useFlip } from "./flip";import Icon from "./Icon";@@ -57,18 +56,6 @@ export interface SortableItem {icon?: string;}-/** One button of an {@link ItemCreationRow}. */-export interface ItemCreationRowButton {- label: string;- /** An icon class, `bx` prefix included. */- icon?: string;- /** Turns the button off, for a caller that cannot make an entry yet. */- disabled?: boolean;- /** The button's `name` attribute, which tests find it by. */- name?: string;- onClick: (event: MouseEvent) => void;-}-/*** One way of creating an entry, rendered as a button at the foot of the card.*@@ -635,41 +622,6 @@ export function SortableCard<T extends SortableItem>({);}-interface ItemCreationRowProps {- buttons: ItemCreationRowButton[];- elementRef?: RefObject<HTMLElement | null>;- onKeyDown?: (event: KeyboardEvent) => void;-}--/**- * The buttons that create an entry, as the last section of a card. Each is painted as a segment of- * the card rather than as a button, so the row reads as the foot of the list above it.- */-export function ItemCreationRow({ buttons, elementRef, onKeyDown }: ItemCreationRowProps) {- return (- // Transparent: each button paints itself, and the gaps show the card through.- <section ref={elementRef} className="tn-card-section tn-card-adders" onKeyDown={onKeyDown}>- {buttons.map((button, index) => (- <Button- // The position in the row: two buttons can share a label.- key={index}- name={button.name}- // Not a command button: the theme gives those a background, a shadow and a- // minimum width, none of which suit a segment.- kind="lowProfile"- className="tn-card-adder"- text={<>- {button.icon && <Icon icon={button.icon} />}- <span>{button.label}</span>- </>}- disabled={button.disabled}- onClick={button.onClick}- />- ))}- </section>- );-}-/** The entry whose segment holds the focus, directly or through a control, and its index. */function focusedEntry(list: HTMLElement | null, shown: SortableItem[]) {const segment = document.activeElement?.closest<HTMLElement>(".tn-sortable-segment");diff --git a/apps/client/src/widgets/type_widgets/options/content_languages_card.css b/apps/client/src/widgets/type_widgets/options/content_languages_card.cssindex 821e402dfc..8c22a36671 100644--- a/apps/client/src/widgets/type_widgets/options/content_languages_card.css+++ b/apps/client/src/widgets/type_widgets/options/content_languages_card.css@@ -3,6 +3,12 @@}.tn-card.content-languages-card {+ .content-languages-item {+ display: flex;+ align-items: center;+ gap: 0.5em;+ }+.content-languages-title {flex-grow: 1;overflow: hidden;diff --git a/apps/client/src/widgets/type_widgets/options/content_languages_card.spec.tsx b/apps/client/src/widgets/type_widgets/options/content_languages_card.spec.tsxindex 45bbcc8c5a..6040eb5ff7 100644--- a/apps/client/src/widgets/type_widgets/options/content_languages_card.spec.tsx+++ b/apps/client/src/widgets/type_widgets/options/content_languages_card.spec.tsx@@ -37,7 +37,7 @@ describe("ContentLanguagesCard", () => {expect(names(container)).toEqual([ "Deutsch", "Français", "Română" ]);expect(segments(container).map((element) => element.querySelector(".bx-globe"))).not.toContain(null);- expect(container.querySelector(".tn-sortable-grip")).toBeNull();+ expect(container.querySelector(".tn-sortable-card")).toBeNull();expect(container.querySelector(".content-languages-english-name")).toBeNull();});@@ -105,18 +105,14 @@ describe("ContentLanguagesCard", () => {});});- it("removes a language with its button or Delete, focusing the next one", async () => {+ it("removes a language with its button", async () => {const container = draw();+ const remove = segment(container, "Français")?.querySelector(".content-languages-remove");+ expect(remove).toBeInstanceOf(HTMLElement);- await click(segment(container, "Français")?.querySelector(".content-languages-remove")- ?? null);+ await click(remove ?? null);expect(stored()).toEqual([ "ro", "de" ]);-- act(() => segment(container, "Deutsch")?.focus());- press(segment(container, "Deutsch"), "Delete");- expect(stored()).toEqual([ "ro" ]);- expect(names(container)).toEqual([ "Română" ]);- expect(document.activeElement).toBe(segment(container, "Română"));+ expect(names(container)).toEqual([ "Deutsch", "Română" ]);});});@@ -156,8 +152,10 @@ function stored() {return JSON.parse(options.get("languages"));}+/** The enabled languages, each a section of the card. */function segments(container: HTMLElement) {- return [ ...container.querySelectorAll<HTMLElement>(".tn-sortable-segment") ];+ return [ ...container.querySelectorAll<HTMLElement>(+ ".content-languages-card > .tn-card-body > .tn-card-section.content-languages-item") ];}function names(container: HTMLElement) {@@ -170,13 +168,6 @@ function segment(container: HTMLElement, name: string) {element.querySelector(".content-languages-native-name")?.textContent === name) ?? null;}-function press(target: Element | null, key: string) {- act(() => {- target?.dispatchEvent(- new KeyboardEvent("keydown", { key, bubbles: true, cancelable: true }));- });-}-/** Clicks and waits for what the click awaits, such as the picker. */async function click(target: Element | null) {await act(async () => {diff --git a/apps/client/src/widgets/type_widgets/options/content_languages_card.tsx b/apps/client/src/widgets/type_widgets/options/content_languages_card.tsxindex 0fa8c3c40b..7f0f415eaa 100644--- a/apps/client/src/widgets/type_widgets/options/content_languages_card.tsx+++ b/apps/client/src/widgets/type_widgets/options/content_languages_card.tsx@@ -8,9 +8,9 @@ import dialog from "../../../services/dialog";import { getAvailableLocales, getEnglishAnnotation, t } from "../../../services/i18n";import options from "../../../services/options";import ActionButton from "../../react/ActionButton";+import { Card, CardSection, ItemCreationRow } from "../../react/Card";import { useTriliumOption } from "../../react/hooks";import Icon from "../../react/Icon";-import { type SortableItem, SortableCard } from "../../react/SortableCard";const LANGUAGE_ICON = "bx bx-globe";@@ -20,10 +20,6 @@ interface ContentLanguagesCardProps {actions?: ComponentChildren;}-interface LanguageItem extends SortableItem {- englishName: string | null;-}-/*** The languages offered when the language of a text note is chosen, sorted by their native names* as `LOCALES` is.@@ -33,27 +29,26 @@ interface LanguageItem extends SortableItem {export function ContentLanguagesCard({ heading, actions }: ContentLanguagesCardProps) {const [ storedLanguages, setStoredLanguages ] = useTriliumOption("languages");const languages = useMemo(- () => (options.getJson("languages") as string[] | null) ?? [],+ () => readLanguages(),[ storedLanguages ]); // eslint-disable-line react-hooks/exhaustive-depsconst setLanguages = useCallback((ids: string[]) => setStoredLanguages(JSON.stringify(ids)), [ setStoredLanguages ]);- const items = useMemo<LanguageItem[]>(() => LOCALES+ const enabled = useMemo(() => LOCALES.filter((locale) => languages.includes(locale.id)).map((locale) => ({- key: locale.id,- caption: locale.name,- icon: LANGUAGE_ICON,+ id: locale.id,+ name: locale.name,englishName: getEnglishAnnotation(locale)})), [ languages ]);- const availableCount = LOCALES.length - items.length;+ const availableCount = LOCALES.length - enabled.length;const remove = useCallback((id: string) => {setLanguages(languages.filter((candidate) => candidate !== id));}, [ languages, setLanguages ]);- /** Opens the item picker on the languages that are not enabled yet. */- const pick = useCallback(async () => {+ /** Opens the item picker on the languages that are not enabled yet, and adds the one picked. */+ const add = useCallback(async () => {const picked = await dialog.pickSingleItem({title: t("content_language.add_title"),items: getAvailableLocales()@@ -61,58 +56,52 @@ export function ContentLanguagesCard({ heading, actions }: ContentLanguagesCardP.map((locale) => ({ key: locale.id, caption: locale.name, icon: LANGUAGE_ICON }))});- return picked- ? { key: picked.key, caption: picked.caption, icon: picked.icon, englishName: null }- : undefined;- }, [ languages ]);+ // Read again: another window can change the list while the picker is open.+ const current = readLanguages();+ if (picked && !current.includes(picked.key)) {+ setLanguages([ ...current, picked.key ]);+ }+ }, [ languages, setLanguages ]);return (- <SortableCard+ <CardclassName="content-languages-card"heading={heading}actions={actions}description={t("content_language.description")}- items={items}- // The card reports additions only, since it cannot be reordered.- onChange={(order) => setLanguages([- ...languages,- ...order.map((item) => item.key).filter((id) => !languages.includes(id))- ])}- isReorderable={false}- onItemKeyDown={(item, event) => {- if (event.key === "Delete") {- event.preventDefault();- remove(item.key);- }- }}- renderItem={(item) => <>- <Icon icon={LANGUAGE_ICON} />- <span className="content-languages-title">- <span className="content-languages-native-name">{item.caption}</span>- {item.englishName && (- <span className="content-languages-english-name">- {item.englishName}- </span>- )}- </span>- <ActionButton- className="content-languages-remove"- icon="bx bx-x"- text={t("content_language.remove")}- onClick={(event) => {- event.stopPropagation();- remove(item.key);- }}- />- </>}- itemCreationButtons={[ {- label: items.length+ >+ {enabled.map((language) => (+ <CardSection key={language.id} className="content-languages-item">+ <Icon icon={LANGUAGE_ICON} />+ <span className="content-languages-title">+ <span className="content-languages-native-name">{language.name}</span>+ {language.englishName && (+ <span className="content-languages-english-name">+ {language.englishName}+ </span>+ )}+ </span>+ <ActionButton+ className="content-languages-remove"+ icon="bx bx-x"+ text={t("content_language.remove")}+ onClick={() => remove(language.id)}+ />+ </CardSection>+ ))}++ <ItemCreationRow buttons={[ {+ label: enabled.length? t("content_language.add_another", { count: availableCount }): t("content_language.add_first", { count: availableCount }),icon: "bx bx-plus",disabled: !availableCount,- onCreateItem: pick- } ]}- />+ onClick: add+ } ]} />+ </Card>);}++function readLanguages() {+ return (options.getJson("languages") as string[] | null) ?? [];+}diff --git a/apps/client/src/widgets/type_widgets/options/llm.tsx b/apps/client/src/widgets/type_widgets/options/llm.tsxindex 90d80500a1..119cdfa4ce 100644--- a/apps/client/src/widgets/type_widgets/options/llm.tsx+++ b/apps/client/src/widgets/type_widgets/options/llm.tsx@@ -8,7 +8,7 @@ import { t } from "../../../services/i18n";import server from "../../../services/server";import { isStandalone } from "../../../services/utils";import ActionButton from "../../react/ActionButton";-import { Card, CardSection, OptionCardSection } from "../../react/Card";+import { Card, CardSection, ItemCreationRow, OptionCardSection } from "../../react/Card";import CodeBlock from "../../react/CodeBlock";import Collapsible from "../../react/Collapsible";import FormTextBox from "../../react/FormTextBox";@@ -16,7 +16,6 @@ import FormToggle from "../../react/FormToggle";import { useTriliumOption, useTriliumOptionBool } from "../../react/hooks";import Icon from "../../react/Icon";import NoItems from "../../react/NoItems";-import { ItemCreationRow } from "../../react/SortableCard";import { shortModelName } from "../llm_chat/model_name";import OptionsPageHeader from "./components/OptionsPageHeader";import AddProviderModal, { findProviderType, type LlmProviderConfig } from "./llm/AddProviderModal";diff --git a/apps/server/src/assets/help/help_content.json b/apps/server/src/assets/help/help_content.jsonindex b14733f62e..b8e06df488 100644--- a/apps/server/src/assets/help/help_content.json+++ b/apps/server/src/assets/help/help_content.json@@ -120,7 +120,7 @@"_help_NwBbFdNZ9h7O": "<h2>Block quotes</h2><p>As the name suggests, block quotes can be useful to cite one or more paragraphs.</p><p>To create a block quote, press <span class=\"tn-icon cke cke-quote\"></span> from the <a class=\"reference-link\" href=\"#root/_help_nRhnJkTT8cPs\">Formatting toolbar</a>. It's also possible to type <kbd>></kbd>, followed by a space to create one (but only if the cursor is at the beginning of a line).</p><p>Inside the quote block, other block items can be inserted such as tables, images, or even other block quotes or admonitions.</p><h2>Admonitions</h2><p>Admonitions are a way to highlight information to the reader. Other names for it include <em>call-outs</em> and <em>info/warning/alert boxes</em>.</p><figure class=\"image image-style-align-center\"><img style=\"aspect-ratio:959/547;\" src=\"{{helpAssets}}/User%20Guide/Note%20Types/Text/1_Block%20quotes%20%26%20admonitions_image.png\" width=\"959\" height=\"547\"></figure><p>From a functional point of view, admonitions act very similarly to a block quote, just with different styling. This includes the ability to insert other elements in it such as headings, tables, images, etc.</p><h3>Inserting a new admonition</h3><p>In the <a class=\"reference-link\" href=\"#root/_help_nRhnJkTT8cPs\">Formatting toolbar</a>:</p><p><img src=\"{{helpAssets}}/User%20Guide/Note%20Types/Text/Block%20quotes%20%26%20admonitions_image.png\"></p><p>It's possible to insert an admonition simply by typing:</p><ul><li><code>!!! note</code></li><li><code>!!! tip</code></li><li><code>!!! important</code></li><li><code>!!! caution</code></li><li><code>!!! warning</code></li></ul><p>In addition to that, it's also possible to type <code>!!!</code> followed by any text, case in which a default admonition type will appear (note) with the entered text inside it.</p><h3>Interaction</h3><p>By design, admonitions act very similar to block quotes.</p><ul><li>Selecting a text and pressing the admonition button will turn that text into an admonition.</li><li>If selecting multiple admonitions, pressing the admonition button will automatically merge them into one.</li></ul><p>Inside an admonition:</p><ul><li>Pressing <kbd>Backspace</kbd> while the admonition is empty will remove it.</li><li>Pressing <kbd>Enter</kbd> will start a new paragraph. Pressing it twice will exit out of the admonition.</li><li>Headings and other block content including tables can be inserted inside the admonition.</li></ul><h3>Types of admonitions</h3><p>There are currently five types of admonitions: <em>Note</em>, <em>Tip</em>, <em>Important</em>, <em>Caution</em>, <em>Warning</em>.</p><p>These types were inspired by GitHub's support for this feature and there are currently no plans for adjusting it or allowing the user to customize them.</p><h3>Markdown support</h3><p>See <a class=\"reference-link\" href=\"#root/_help_rJ9grSgoExl9\">Supported syntax</a>.</p>","_help_klC3ilXa9kUE": "<p>Block references are <a href=\"#root/_help_QEAPj01N5f7w\">links</a> to a block of a text note, such as a paragraph, a heading, a list item or a table, or to a range of consecutive blocks. A block reference can be pasted in another note as a link, or turned into an <a class=\"reference-link\" href=\"#root/_help_nBAXQFj20hS1\">Include Note</a> that shows only the referenced blocks.</p><h2>Copying a reference</h2><ol><li>Place the cursor in the block to reference. To reference several consecutive blocks, select them.</li><li>Right-click the block handle, the sequence of dots to the left of the block (see <a class=\"reference-link\" href=\"#root/_help_nRhnJkTT8cPs\">Formatting toolbar</a>). Alternatively, right-click the text and open the <em>Copy</em> submenu.</li><li>Select <em>Copy reference to this block</em>, or <em>Copy reference to these blocks</em> for a selection. The referenced blocks flash briefly.</li><li>Go to the note where to insert the link and press <kbd>Ctrl</kbd>+<kbd>V</kbd>.</li></ol><p>Inside a <a class=\"reference-link\" href=\"#root/_help_EK2ckIZ74tbT\">Content tabs</a> block, the reference points to the whole block. To link to a single tab, use <em>Copy link to tab</em> instead. Inside a <a class=\"reference-link\" href=\"#root/_help_wYDzQ1fBFgfT\">Multicolumn layout</a>, the reference points to the blocks in the column, and an include shows them without the layout around them.</p><p>The link shows the title of the note, followed by the beginning of the referenced text. A link to blocks of the same note shows only the beginning of the referenced text.</p><p>If the note is <a href=\"#root/_help_R9pX4DGra2Vt\">shared</a>, the menu of the block handle also offers <em>Copy public link to this block</em>. It copies the web address of the shared page with the reference added, to send to people who read the note outside Trilium. Opening the address scrolls the shared page to the referenced blocks and flashes them.</p><p>The <em>Paste</em> submenu of the context menu offers two more ways to insert a copied reference:</p><ul><li><em>Paste reference as a link</em> inserts only the link, even when the reference was copied as plain text or along with other content.</li><li><em>Paste reference as an excerpt</em> inserts an include of the referenced blocks, as described below.</li></ul><p>In a browser, the context menu of the text editor opens only when right-clicking selected text. Elsewhere the browser shows its own menu.</p><h2>Following a reference</h2><p>Clicking a block reference opens the note, scrolls to the referenced blocks and flashes them. If a referenced block was deleted, an error message is shown instead, along with the blocks of the range that still exist.</p><h2>Including the referenced blocks</h2><p>To show the referenced blocks inside another note, right-click the link in a note being edited and select <em>Convert link to note excerpt</em>, or paste the copied reference with <em>Paste</em> → <em>Paste reference as an excerpt</em>. The include shows only the referenced blocks, not the rest of the note, and marks them with an <em>Excerpt</em> badge in its title. It starts at the <em>Full</em> box size, so all the referenced blocks are visible. To see the whole note, press the <span class=\"tn-icon bx bx-link-external\"></span> button in the same title, which opens the note in a new tab. Converting the include back to a link keeps the reference.</p><p>To edit the referenced blocks without leaving the note, press the <span class=\"tn-icon bx bx-pencil\"></span> <em>Edit excerpt</em> button in the title of the include, or turn on <em>Editable</em> (<span class=\"tn-icon bx bx-edit-alt\"></span>) in its toolbar, as for any <a class=\"reference-link\" href=\"#root/_help_nBAXQFj20hS1\">Include Note</a>. Press the button again to stop editing. The changes are saved to the referenced blocks, and the rest of the note stays as it is. The button is grayed out where the blocks cannot be edited, such as in a read-only note. An excerpt has no <em>Fullscreen</em> button.</p><p>If a referenced block was deleted, the include shows <em>Broken reference</em>.</p><h2>Limitations</h2><ul><li>References can be copied only from a note being edited, and not in the mobile layout.</li><li>An include of a range that covers only part of a list or a quote, such as from its second item to a paragraph after it, cannot be edited in place.</li><li>Deleting a block breaks the references to it.</li><li>Block references are not kept when exporting to Markdown. On a <a href=\"#root/_help_R9pX4DGra2Vt\">shared page</a>, a block reference opens the whole note.</li></ul>","_help_4n4oQUVbnOxa": "<p>Collapsible blocks are sections of content that can be expanded and collapsed, letting you hide detail until it's needed.</p><p>A collapsible block consists of:</p><ul><li><strong>An always-visible header</strong>, containing:<ul><li><strong>An arrow</strong> that expands or collapses the block when clicked.</li><li><strong>A summary line</strong> that acts as the block's title. With the cursor in the summary line, press <kbd>Ctrl</kbd>+<kbd>Enter</kbd> to expand or collapse the block.</li><li><strong>A drag handle</strong> for repositioning the block within the note.</li></ul></li><li><strong>The body</strong>, which is hidden while the block is collapsed. It can hold any kind of content, including nested collapsible blocks. To break out of a collapsible block and continue typing outside it, press <kbd>Enter</kbd> twice at the end of the block.</li></ul><p>You can use the arrow keys to move freely with the cursor between the summary line, the block's body, and the text around the block.</p><h2>Inserting a collapsible block</h2><p>In the formatting bar, go to <em>Insert</em> → <em>Collapsible Block</em>.</p><aside class=\"admonition tip\"><p>Place multiple collapsible blocks one after another to create an accordion, where each block can be expanded or collapsed independently.</p></aside>",- "_help_veGu4faJErEM": "<p><img src=\"{{helpAssets}}/User%20Guide/Note%20Types/Text/Content%20language%20%26%20Right-to-left%20support_image.jpg\"></p><p>The content language determines:</p><ul><li>The spell-checking of the note, when in a browser. The desktop installation has a dedicated spellchecking section.</li><li>Whether the text is displayed from right-to-left, for languages such as Arabic, Hebrew, etc.</li><li>How typed quotes are <a href=\"#root/_help_oI7GoyilXXAr\">automatically replaced</a> (e.g. English uses <code>“text”</code>, whereas some languages use <code>«text»</code>). This applies only if <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> → <em>Text</em> → <em>Single/Double quotation marks</em> is set to <em>Based on note's content language</em>.</li><li>Which languages are offered by the <a class=\"reference-link\" href=\"#root/_help_VRoP0g1uHHc2\">In-editor AI assistant</a> for translation.</li><li>The language and the text direction the content is marked with on a <a href=\"#root/_help_R9pX4DGra2Vt\">shared page</a>, which screen readers and browsers follow.</li></ul><h2>Setting the language of a single note</h2><p>To set the language of the content of a <a class=\"reference-link\" href=\"#root/_help_iPIMuisry3hd\">Text</a> note, there is a language selector in the <a class=\"reference-link\" href=\"#root/_help_AlJ73vBCjWDw\">Status bar</a> indicated by a <span class=\"tn-icon bx bx-globe\"></span> icon.</p><h2>Adjusting the list of languages</h2><p>By default, no language is configured. To configure them, go to <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> → <em>Language & Region</em> → <em>Content languages</em>, or select the <em>Configure languages...</em> item when setting the language. The enabled languages are listed by their native names, sorted alphabetically, which is also the order the language selector shows them in. Here you can:</p><ul><li>Add a language by pressing the <span class=\"tn-icon bx bx-plus\"></span> <em>Add a language</em> button (<em>Add another language</em> once one is enabled), which also shows how many languages are left, and then selecting it.</li><li>Press the <span class=\"tn-icon bx bx-x\"></span> button beside a language, or select it and press <kbd>Delete</kbd>, to remove it from the list.</li></ul><h2>Default content language</h2><p>Notes that do not have a language of their own follow <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> → <em>Language & Region</em> → <em>Default content language</em>. It is set to English initially, and can be set to any content language, or to <em>Based on the application's language</em>.</p><p>If a note has a language set, it always takes precedence over the default.</p>",+ "_help_veGu4faJErEM": "<p><img src=\"{{helpAssets}}/User%20Guide/Note%20Types/Text/Content%20language%20%26%20Right-to-left%20support_image.jpg\"></p><p>The content language determines:</p><ul><li>The spell-checking of the note, when in a browser. The desktop installation has a dedicated spellchecking section.</li><li>Whether the text is displayed from right-to-left, for languages such as Arabic, Hebrew, etc.</li><li>How typed quotes are <a href=\"#root/_help_oI7GoyilXXAr\">automatically replaced</a> (e.g. English uses <code>“text”</code>, whereas some languages use <code>«text»</code>). This applies only if <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> → <em>Text</em> → <em>Single/Double quotation marks</em> is set to <em>Based on note's content language</em>.</li><li>Which languages are offered by the <a class=\"reference-link\" href=\"#root/_help_VRoP0g1uHHc2\">In-editor AI assistant</a> for translation.</li><li>The language and the text direction the content is marked with on a <a href=\"#root/_help_R9pX4DGra2Vt\">shared page</a>, which screen readers and browsers follow.</li></ul><h2>Setting the language of a single note</h2><p>To set the language of the content of a <a class=\"reference-link\" href=\"#root/_help_iPIMuisry3hd\">Text</a> note, there is a language selector in the <a class=\"reference-link\" href=\"#root/_help_AlJ73vBCjWDw\">Status bar</a> indicated by a <span class=\"tn-icon bx bx-globe\"></span> icon.</p><h2>Adjusting the list of languages</h2><p>By default, no language is configured. To configure them, go to <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> → <em>Language & Region</em> → <em>Content languages</em>, or select the <em>Configure languages...</em> item when setting the language. The enabled languages are listed by their native names, sorted alphabetically, which is also the order the language selector shows them in. Here you can:</p><ul><li>Add a language by pressing the <span class=\"tn-icon bx bx-plus\"></span> <em>Add a language</em> button (<em>Add another language</em> once one is enabled), which also shows how many languages are left, and then selecting it.</li><li>Press the <span class=\"tn-icon bx bx-x\"></span> button beside a language to remove it from the list.</li></ul><h2>Default content language</h2><p>Notes that do not have a language of their own follow <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> → <em>Language & Region</em> → <em>Default content language</em>. It is set to English initially, and can be set to any content language, or to <em>Based on the application's language</em>.</p><p>If a note has a language set, it always takes precedence over the default.</p>","_help_EK2ckIZ74tbT": "<p>Content tabs group several titled panels of content into one block that shows a single panel at a time. They suit content that comes in variants (such as installation steps for each operating system or the same snippet in several programming languages).</p><p>A tabs block consists of:</p><ul><li><strong>A single row of tab titles</strong>, above the panel or, when the tabs are aligned at the bottom, below it. The title of the panel that is showing is highlighted.</li><li><strong>The panel of the active tab.</strong> A panel can hold any kind of content (including nested tabs blocks).</li></ul><h2>Inserting a tabs block</h2><ul><li>In the formatting bar, go to <em>Insert</em> → <em>Tabs</em>.</li><li>Alternatively, type <code>/tabs</code> and press <kbd>Enter</kbd>, as described in <a class=\"reference-link\" href=\"#root/_help_ZlN4nump6EbW\">Slash Commands</a>.</li></ul><p>A new block contains two tabs, named “Tab 1” and “Tab 2”. Any content that was selected prior to inserting the tabs will be moved into the first tab. The title of the first tab is selected, so typing replaces it.</p><h2>Scrolling through the titles</h2><p>When the titles of a block do not fit on their row, a <span class=\"tn-icon bx bx-chevron-left\"></span> button and a <span class=\"tn-icon bx bx-chevron-right\"></span> button appear at its ends:</p><ul><li>To scroll the titles, click one of the buttons. Holding a button down scrolls the titles continuously until it is released.</li><li>On a touch screen, the titles can also be swiped sideways.</li></ul><p>Whenever another tab is shown (for example by clicking its title, by moving the cursor into it or by following a link to it), the row scrolls so that its whole title is visible. This works the same while editing, in read-only notes and on shared pages.</p><h2>Editing tabs</h2><ul><li>To show a tab, click its title or move the cursor into it.</li><li>To move from a title into its panel, press <kbd>Enter</kbd>.</li><li>The label of a tab can be formatted just like normal text, including support for <a class=\"reference-link\" href=\"#root/_help_hD8GawVuazff\">Icons</a>.</li></ul><p>While the cursor is inside a tabs block, a toolbar appears above it with the following buttons:</p><ul><li><span class=\"tn-icon cke cke-plus\"></span> <em>(Add tab)</em> inserts a tab after the current one and selects its title.</li><li><span class=\"tn-icon cke cke-remove\"></span> <em>(Remove tab)</em> removes the current tab. Removing the last tab removes the whole block.</li><li><span class=\"tn-icon cke cke-chevron-right bx-flip-horizontal\"></span> <em>(Move tab left)</em> and <span class=\"tn-icon cke cke-chevron-right\"></span> (<em>Move tab right)</em> change the order of the tabs.</li><li><span class=\"tn-icon cke cke-link\"></span> <em>(Copy link to tab)</em> copies a link to the current tab, as described below.</li><li><span class=\"tn-icon cke cke-trilium-tabs\"></span> <em>(Tab alignment)</em> places the tab titles above the panel (<em>Align tabs at top</em>, the default) or below it (<em>Align tabs at bottom</em>).</li></ul><p>The tab that is showing is not saved with the note: every tabs block opens on its first tab.</p><h3>Adding tabs</h3><p>While the cursor is in a tab, either in its title or in its panel, you can use these key combinations:</p><ul><li><kbd>Ctrl</kbd> + <kbd>Enter</kbd>: Add a tab after the current one.</li><li><kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Enter</kbd>: Add a tab before the current one.</li></ul><p>The new tab is shown and its title is selected, so typing replaces it.</p><p><kbd>Ctrl</kbd> + <kbd>Enter</kbd> keeps its usual function on a link, in a to-do item and in the title of a collapsible block, and <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Enter</kbd> in a to-do item.</p><h3>Reordering tabs</h3><p>While the cursor is in a tab, either in its title or in its panel, you can use these key combinations:</p><ul><li><kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <kbd>Right</kbd>: Move the tab to the right.</li><li><kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <kbd>Left</kbd>: Move the tab to the left.</li><li><kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <kbd>Home</kbd>: Make it the first tab.</li><li><kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <kbd>End</kbd>: Make it the last tab.</li></ul><h2>Moving content between tabs</h2><p>To move content to another tab, select it in the panel, and then use these key combinations:</p><ul><li><kbd>Ctrl</kbd> + <kbd>Right</kbd>: Move to the tab on the right.</li><li><kbd>Ctrl</kbd> + <kbd>Left</kbd>: Move to the tab on the left.</li><li><kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>End</kbd>: Move to the last tab.</li><li><kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Home</kbd>: Move to the first tab.</li></ul><p>The tab that receives the content is shown, with the content still selected, so pressing the key again moves it on to the next tab. Paragraphs, list items, tables and other blocks move whole, even when only part of them is selected. Content moved to a tab on the left goes to the end of that tab, and content moved to a tab on the right goes to its start, so it keeps its place in the reading order.</p><p>Without a selection, or with a selection in a tab title, these keys keep their usual function: moving the cursor by word, or selecting up to the start or end of the tab.</p><p>When a tabs block and a <a class=\"reference-link\" href=\"#root/_help_wYDzQ1fBFgfT\">Multicolumn layout</a> are nested in one another, the key combinations act on the one closest to the cursor.</p><h2>Reading tabs</h2><p>In <a class=\"reference-link\" href=\"#root/_help_CoFPLs3dRlXc\">Read-Only Notes</a> and on <a class=\"reference-link\" href=\"#root/_help_R9pX4DGra2Vt\">Sharing</a>, tabs blocks work as tabs as well:</p><ul><li>To show a tab, click its title, or focus it and press <kbd>Enter</kbd> or <kbd>Space</kbd>.</li><li>To move between the titles of a block, use the arrow keys, <kbd>Home</kbd> and <kbd>End</kbd>.</li></ul><p>A tab without a title shows “Tab title” in place of one.</p><p>In read-only notes, a title too long for its tab fades out where it is cut off. To read the rest of it, swipe it sideways or drag it with the mouse.</p><h2>Linking to a tab</h2><p>A link can point to a single tab, much like a link to a block (see <a class=\"reference-link\" href=\"#root/_help_klC3ilXa9kUE\">Block references</a>):</p><ol><li>Place the cursor in the tab, either in its title or in its panel.</li><li>Press <em>Copy link to tab</em> (<span class=\"tn-icon cke cke-link\"></span>) in the toolbar of the tabs block. Alternatively, right-click the text and select <em>Copy</em> → <em>Copy link to this tab</em>. The tab flashes briefly.</li><li>Go to the note where to insert the link and press <kbd>Ctrl</kbd>+<kbd>V</kbd>.</li></ol><p>The link shows the title of the note, followed by the title of the tab. Clicking it opens the note, shows the tab and flashes it. As with any block reference, the link can be turned into an <a class=\"reference-link\" href=\"#root/_help_nBAXQFj20hS1\">Include Note</a> that shows only that tab.</p><p>Links to a tab can be copied only from a note being edited. On a <a href=\"#root/_help_R9pX4DGra2Vt\">shared page</a>, such a link opens the whole note.</p><h2>Content in hidden tabs</h2><p>Content inside a tab that is not showing is still reachable (both while editing and while reading). The tab that holds it is shown when:</p><ul><li>searching the note with <kbd>Ctrl</kbd>+<kbd>F</kbd> highlights a match inside it;</li><li>a link points to an anchor or a block inside it (see <a class=\"reference-link\" href=\"#root/_help_oSuaNgyyKnhu\">Anchors</a> and <a class=\"reference-link\" href=\"#root/_help_klC3ilXa9kUE\">Block references</a>);</li><li>an entry of the <a class=\"reference-link\" href=\"#root/_help_BFvAtE74rbP6\">Table of contents</a> or the <a class=\"reference-link\" href=\"#root/_help_AxshuNRegLAv\">Highlights list</a> points inside it;</li><li>on a shared page, the address of the page points to a heading or an anchor inside it.</li></ul><p>Tab titles are not headings, so they do not appear in the table of contents; headings inside a panel do.</p><h2>Printing and exporting</h2><ul><li>When printing or <a href=\"#root/_help_NRnIZmSMc5sj\">exporting to PDF</a>, every tab is printed, one after another, each with its title above its panel, whatever the tab alignment.</li><li>Markdown export and import write tabs blocks in the content tabs syntax of Material for MkDocs, described in <a class=\"reference-link\" href=\"#root/_help_rJ9grSgoExl9\">Supported syntax</a>. <a class=\"reference-link\" href=\"#root/_help_6RM1Q7ppFVoj\">Markdown</a> notes use the same syntax, show the blocks as tabs in their preview and insert them with <code>/tabs</code>. That syntax has no tab alignment, so tabs aligned at the bottom are exported as regular tabs.</li><li>Anywhere the tabs cannot work as tabs (such as an HTML export opened elsewhere), a tabs block reads as a sequence of titled sections.</li></ul>","_help_2x0ZAX9ePtzV": "<figure class=\"image image_resized image-style-align-right\" style=\"width:64.63%;\"><img style=\"aspect-ratio:812/585;\" src=\"{{helpAssets}}/User%20Guide/Note%20Types/Text/Cut%20to%20subnote_cut-to-subnote.gif\" width=\"812\" height=\"585\"></figure><p>When editing a document that becomes too large, you can split it into sub-notes:</p><ol><li>Select the desired text and cut it to the clipboard.</li><li>Create a new sub-note and name it.</li><li>Paste the content from the clipboard into the sub-note.</li></ol><p>Trilium can automate this process. Select some text within the note, and in the selection toolbar, click the scissors icon for the \"cut & pasted selection to sub-note\" action. The heading is automatically detected and the new sub-note is named accordingly. You can also assign a keyboard shortcut for this action. This functionality is available through the block toolbar icon. On a phone, the scissors are at the end of the text formatting row, which shows as you select text.</p>","_help_UYuUB1ZekNQU": "<h3>Inline code</h3><p>Inline code formats text using a monospace font to indicate technical content in a sentence such as code, paths, etc.</p><p><img src=\"{{helpAssets}}/User%20Guide/Note%20Types/Text/Developer-specific%20formatting_image.png\"></p><p>Example of inline code being used to illustrate file system paths as well as shell commands (<code>git</code> in this case).</p><p>To insert an inline code:</p><ul><li>Via the <a href=\"#root/_help_nRhnJkTT8cPs\">Formatting toolbar</a>, look for the <span class=\"tn-icon cke cke-code\"></span> button.</li><li>Type `code` where <code>code</code> is the desired text to be automatically formatted as inline code.</li><li>Paste a single line copied from Visual Studio Code. See <a href=\"#root/_help_QxEyIjRBizuC\">Code blocks</a> for pasting several lines.</li></ul><h3>Code blocks</h3><p>Code blocks display a snippet of code as a dedicated block:</p><p><img src=\"{{helpAssets}}/User%20Guide/Note%20Types/Text/1_Developer-specific%20formatting_image.jpg\"></p><p>A code block with JavaScript syntax highlight enabled.</p><p>Note that these are not meant for very large portions of code. Use the dedicated <a href=\"#root/_help_6f9hih2hXXZk\">Code</a> note type instead.</p><p>See the dedicated documentation for more information: <a href=\"#root/_help_QxEyIjRBizuC\">Code blocks</a></p><h3>Keyboard shortcuts</h3><p>This allows marking a portion of text as a shortcut key.</p><p><img src=\"{{helpAssets}}/User%20Guide/Note%20Types/Text/Developer-specific%20formatting_image.jpg\"></p><p>To apply this style, press the <span class=\"tn-icon cke cke-trilium-kbd\"></span> button in <span class=\"tn-icon bx bx-text\"></span> group from the <a href=\"#root/_help_nRhnJkTT8cPs\">Formatting toolbar</a>. On the floating toolbar, the buttons appear when selecting a text.</p><p>Alternatively, press the <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>K</kbd> combination to apply keyboard shortcut formatting to the current text selection.</p><p>The formatting can be removed by pressing again the button (from the UI or from the keyboard), or by using the <span class=\"tn-icon cke cke-remove-format\"></span> <em>Remove formatting</em> button.</p>",diff --git a/docs/User Guide/User Guide/Note Types/Text/Content language & Right-to-left support.md b/docs/User Guide/User Guide/Note Types/Text/Content language & Right-to-left support.mdindex 5f5fefd1c9..cf3a528a07 100644--- a/docs/User Guide/User Guide/Note Types/Text/Content language & Right-to-left support.md+++ b/docs/User Guide/User Guide/Note Types/Text/Content language & Right-to-left support.md@@ -18,7 +18,7 @@ To set the language of the content of a <a class="reference-link" href="../TextBy default, no language is configured. To configure them, go to <a class="reference-link" href="../../Basic%20Concepts%20and%20Features/UI%20Elements/Options.md">Options</a> → _Language & Region_ → _Content languages_, or select the _Configure languages..._ item when setting the language. The enabled languages are listed by their native names, sorted alphabetically, which is also the order the language selector shows them in. Here you can:* Add a language by pressing the <span class="tn-icon bx bx-plus"></span> _Add a language_ button (_Add another language_ once one is enabled), which also shows how many languages are left, and then selecting it.-* Press the <span class="tn-icon bx bx-x"></span> button beside a language, or select it and press <kbd>Delete</kbd>, to remove it from the list.+* Press the <span class="tn-icon bx bx-x"></span> button beside a language to remove it from the list.## Default content language