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
Merge remote-tracking branch 'origin/main' into feature/some_fixes
Elian Dorane7fc038a3b5f
diff --cc apps/client/src/stylesheets/theme-next/buttons.cssindex 50a74e6385,7f157d4e80..56b3d2f942--- a/apps/client/src/stylesheets/theme-next/buttons.css+++ b/apps/client/src/stylesheets/theme-next/buttons.css@@@ -6,8 -6,9 +6,9 @@@ button.btn.btn-primarybutton.btn.btn-secondary,button.btn.btn-sm:not(.select-button),button.btn.btn-success,-button.ck.ck-button:is(.ck-button-action, .ck-button-save, .ck-button-cancel, .ck-button-replaceall, .ck-button-replace).ck-button_with-text,+button.ck.ck-button:is(.ck-button-action, .ck-button-save, .ck-button-cancel, .ck-button-replaceall, .ck-button-replace, .ck-button_standard).ck-button_with-text,.ck-ai-assistant-form__actions > button.ck.ck-button.ck-button_with-text,+ .ck-table-form__action-row > button.ck.ck-button.ck-button_with-text,button.ck.ck-button.ck-ai-assistant-form__icon-action {display: inline-flex;align-items: center;@@@ -29,8 -30,9 +30,9 @@@ button.btn.btn-primary:hoverbutton.btn.btn-secondary:hover,button.btn.btn-sm:not(.select-button):hover,button.btn.btn-success:hover,-button.ck.ck-button:is(.ck-button-action, .ck-button-save, .ck-button-cancel, .ck-button-replaceall, .ck-button-replace).ck-button_with-text:not(.ck-disabled):hover,+button.ck.ck-button:is(.ck-button-action, .ck-button-save, .ck-button-cancel, .ck-button-replaceall, .ck-button-replace, .ck-button_standard).ck-button_with-text:not(.ck-disabled):hover,.ck-ai-assistant-form__actions > button.ck.ck-button.ck-button_with-text:not(.ck-disabled):hover,+ .ck-table-form__action-row > button.ck.ck-button.ck-button_with-text:not(.ck-disabled):hover,button.ck.ck-button.ck-ai-assistant-form__icon-action:not(.ck-disabled):hover {background: var(--cmd-button-hover-background-color);color: var(--cmd-button-hover-text-color);@@@ -40,8 -42,9 +42,9 @@@ button.btn.btn-primary:activebutton.btn.btn-secondary:active,button.btn.btn-sm:not(.select-button):active,button.btn.btn-success:active,-button.ck.ck-button:is(.ck-button-action, .ck-button-save, .ck-button-cancel, .ck-button-replaceall, .ck-button-replace).ck-button_with-text:not(.ck-disabled):active,+button.ck.ck-button:is(.ck-button-action, .ck-button-save, .ck-button-cancel, .ck-button-replaceall, .ck-button-replace, .ck-button_standard).ck-button_with-text:not(.ck-disabled):active,.ck-ai-assistant-form__actions > button.ck.ck-button.ck-button_with-text:not(.ck-disabled):active,+ .ck-table-form__action-row > button.ck.ck-button.ck-button_with-text:not(.ck-disabled):active,button.ck.ck-button.ck-ai-assistant-form__icon-action:not(.ck-disabled):active {opacity: 0.85;box-shadow: unset;@@@ -54,8 -57,9 +57,9 @@@ button.btn.btn-primary:disabledbutton.btn.btn-secondary:disabled,button.btn.btn-sm:not(.select-button):disabled,button.btn.btn-success:disabled,-button.ck.ck-button:is(.ck-button-action, .ck-button-save, .ck-button-cancel, .ck-button-replaceall, .ck-button-replace).ck-button_with-text.ck-disabled,+button.ck.ck-button:is(.ck-button-action, .ck-button-save, .ck-button-cancel, .ck-button-replaceall, .ck-button-replace, .ck-button_standard).ck-button_with-text.ck-disabled,.ck-ai-assistant-form__actions > button.ck.ck-button.ck-button_with-text.ck-disabled,+ .ck-table-form__action-row > button.ck.ck-button.ck-button_with-text.ck-disabled,button.ck.ck-button.ck-ai-assistant-form__icon-action.ck-disabled {opacity: var(--cmd-button-disabled-opacity);}@@@ -64,8 -68,9 +68,9 @@@ button.btn.btn-primary:focus-visiblebutton.btn.btn-secondary:focus-visible,button.btn.btn-sm:not(.select-button):focus-visible,button.btn.btn-success:focus-visible,-button.ck.ck-button:is(.ck-button-action, .ck-button-save, .ck-button-cancel, .ck-button-replaceall, .ck-button-replace).ck-button_with-text:not(.ck-disabled):focus-visible,+button.ck.ck-button:is(.ck-button-action, .ck-button-save, .ck-button-cancel, .ck-button-replaceall, .ck-button-replace, .ck-button_standard).ck-button_with-text:not(.ck-disabled):focus-visible,.ck-ai-assistant-form__actions > button.ck.ck-button.ck-button_with-text:not(.ck-disabled):focus-visible,+ .ck-table-form__action-row > button.ck.ck-button.ck-button_with-text:not(.ck-disabled):focus-visible,button.ck.ck-button.ck-ai-assistant-form__icon-action:not(.ck-disabled):focus-visible,.tn-focusable-button:focus-visible {outline: 2px solid var(--input-focus-outline-color);diff --cc apps/client/src/stylesheets/theme-next/notes/text.cssindex 24a9d72142,9fb78a6d5d..a0838678b9--- a/apps/client/src/stylesheets/theme-next/notes/text.css+++ b/apps/client/src/stylesheets/theme-next/notes/text.css@@@ -613,7 -793,8 +803,8 @@@ body.background-effects .ck-math-form m* Buttons*/- button.ck.ck-button:is(.ck-button-action, .ck-button-save, .ck-button-cancel, .ck-button_standard).ck-button_with-text {-button.ck.ck-button:is(.ck-button-action, .ck-button-save, .ck-button-cancel).ck-button_with-text,++button.ck.ck-button:is(.ck-button-action, .ck-button-save, .ck-button-cancel, .ck-button_standard).ck-button_with-text,+ .ck-table-form__action-row > button.ck.ck-button.ck-button_with-text {--ck-color-text: var(--cmd-button-text-color);min-width: 60px;diff --cc apps/client/src/widgets/type_widgets/text/attachment_saves.spec.tsindex 4f3f225acc,281fc5f58f..6687d39f51--- a/apps/client/src/widgets/type_widgets/text/attachment_saves.spec.ts+++ b/apps/client/src/widgets/type_widgets/text/attachment_saves.spec.ts@@@ -1,6 -1,6 +1,6 @@@import { h, render } from "preact";import { act } from "preact/test-utils";- import { beforeEach, describe, expect, it, vi } from "vitest";-import { afterEach, describe, expect, it, vi } from "vitest";++import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";import Component from "../../../components/component";import type NoteContext from "../../../components/note_context";@@@ -180,23 -190,37 +200,55 @@@ describe("useAttachmentEditor", () =>expect(serverPost).toHaveBeenLastCalledWith(...savedRequest("second"));});+ it("drops the changes to a note deleted before they save", async () => {+ component = new Component();+ const container = document.createElement("div");+ await act(() => {+ render(h(ParentComponent.Provider, { value: component }, h(Probe, {})), container);+ });++ editor?.scheduleSave(drawing, () => "first");+ delete frocaNotes.note1;+ await act(async () => {+ await component.handleEvent("beforeNoteSwitch", { noteContext } as never);+ });+ expect(serverPost).not.toHaveBeenCalled();+ expect(editor?.getUnsavedContent("drawing1")).toBeUndefined();+ expect(noteContext.setContextData).toHaveBeenLastCalledWith("saveState", { state: "saved" });+ await act(() => render(null, container));+ });+++ it("saves once the changes pause for a second, or 10 s after the first one", async () => {+ vi.useFakeTimers();+ serverPost.mockClear();+ component = new Component();+ const container = document.createElement("div");+ await act(() => {+ render(h(ParentComponent.Provider, { value: component }, h(Probe, {})), container);+ });+ // A stroke every 400 ms, which the drawing reports as it ends.+ let strokes = 0;+ const write = async (count: number) => {+ for (let i = 0; i < count; i++) {+ const content = `stroke ${++strokes}`;+ editor?.postponeSave();+ editor?.scheduleSave(drawing, () => content);+ await vi.advanceTimersByTimeAsync(400);+ }+ };++ await write(5);+ expect(serverPost).not.toHaveBeenCalled();+ await vi.advanceTimersByTimeAsync(1000);+ expect(serverPost).toHaveBeenCalledExactlyOnceWith(...savedRequest("stroke 5"));++ await write(24);+ expect(serverPost).toHaveBeenCalledOnce();+ await write(2);+ expect(serverPost).toHaveBeenCalledTimes(2);++ await act(() => render(null, container));+ });});describe("NoteSaves", () => {diff --cc apps/server/src/assets/help/help_content.jsonindex b7d09f410d,c686d36a91..ba651f2585--- a/apps/server/src/assets/help/help_content.json+++ b/apps/server/src/assets/help/help_content.json@@@ -127,10 -127,10 +127,10 @@@"_help_QxEyIjRBizuC": "<p><img src=\"{{helpAssets}}/User%20Guide/Note%20Types/Text/Developer-specific%20formatting/Code%20blocks_image.jpg\"></p><p>The code blocks feature allows entering pieces of code in text notes.</p><p>Note that this feature is meant for generally small snippets of code. For larger files such as an entire log, see the <a class=\"reference-link\" href=\"#root/_help_6f9hih2hXXZk\">Code</a> note type instead.</p><h2>Inserting a code block</h2><ul><li>Via the <a class=\"reference-link\" href=\"#root/_help_nRhnJkTT8cPs\">Formatting toolbar</a>, look for the <span class=\"tn-icon cke cke-code-block\"></span> button.<ul><li>Pressing directly on the icon will insert a code block with the language that was selected most recently. If this is the first time a code block is inserted, the language will be “Auto-detected” by default.</li><li>Pressing the arrow next to the icon, which will show a popup with the available languages.</li></ul></li><li>Type <code>```</code> (as in Markdown).<ul><li>Note that it's not possible to specify the language, as it will default to the last selected language.</li></ul></li><li>Paste several lines of code copied from Visual Studio Code.<ul><li>The code block uses the language of the file in Visual Studio Code.</li><li>If that language is not in the list of languages, the code block uses <em>Auto-detected</em>.</li><li>The colors of the Visual Studio Code theme are removed.</li><li>A single line becomes inline code instead of a code block.</li><li>In Firefox, the code block always uses <em>Auto-detected</em>. Firefox can't read the language from Visual Studio Code.</li></ul></li></ul><h2>Exiting out of the code block</h2><ul><li>To exit out of a code block and enter a normal paragraph, move the cursor at the end of the code block and press Enter twice.</li><li>Similarly, to insert a paragraph above the note block, move the cursor at the beginning of the code block and press Enter twice.</li></ul><aside class=\"admonition note\"><p>If you've pasted a code block with a more complex HTML structure, exiting out of the code block by pressing Enter multiple times might not work. In that case the best approach is to delete the code block entirely and use Ctrl+Shift+V (paste as plain text).</p></aside><h2>Syntax highlighting & color schemes</h2><p>Since TriliumNext v0.90.12, Trilium will try to offer syntax highlighting to the code block. Note that the syntax highlighting mechanism is slightly different than the one in <a class=\"reference-link\" href=\"#root/_help_6f9hih2hXXZk\">Code</a> notes as different technologies are involved.</p><p>Interaction:</p><ul><li>When the language is set to <em>Auto-detected</em> (by default), Trilium will try to identify the programming language (or similar) that corresponds to the given snippet of text and highlight it. Only the languages enabled in <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> → <em>Code Notes</em> → <em>Available MIME types in the dropdown</em> are considered. If this is problematic, consider changing the language of the code block manually.</li><li>When the language is set to <em>Plain text</em>, there will be no syntax highlighting.</li></ul><p>Note that when editing a text note, syntax highlighting is automatically disabled if the code block is too big (somewhere around 500 lines). In <a class=\"reference-link\" href=\"#root/_help_CoFPLs3dRlXc\">Read-Only Notes</a>, in print and on a <a href=\"#root/_help_R9pX4DGra2Vt\">shared page</a>, a code block of more than 500 lines or 50,000 characters is shown without syntax highlighting. These limits are not configurable.</p><p>In order to configure this new feature, a section has been added in <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> → <em>Appearance</em> to control the syntax highlighting. There the color scheme can be chosen, from a builtin selection of themes from Highlight.js. <em>VS Code (Light)</em> and <em>VS Code (Dark)</em> use the same colors as the default themes of <a class=\"reference-link\" href=\"#root/_help_6f9hih2hXXZk\">Code</a> notes, so a code block and a code note color the same code alike.</p><ul><li>It is possible to disable the syntax highlighting for all the notes by selecting “No syntax highlighting” in the “Color scheme” option.</li><li>Word wrapping is disabled by default, but can be configured from the same section.</li><li>The tab width can also be adjusted from Options.</li></ul><aside class=\"admonition note\"><p><strong>Context regarding syntax highlighting</strong></p><p>In order to achieve the syntax highlight, the Highlight.js library is being used. Do note that support for syntax highlighting in code blocks is not a supported feature of the text editor we are using CKEditor), but rather a hack which makes use of the highlights API (used for highlighting search results for example). Nevertheless, we haven't noticed any major issues during the development of the feature, but feel free to report any issues you might have.</p><p>Most of the work to achieve the syntax highlight itself was already done by <a href=\"https://github.com/antoniotejada\">antoniotejada</a> in <a href=\"https://github.com/antoniotejada/Trilium-SyntaxHighlightWidget\">https://github.com/antoniotejada/Trilium-SyntaxHighlightWidget</a>. On our side we added customization but also additional functionality.</p></aside><h3>Migrating from existing syntax highlight plugins</h3><p>If you are already using a syntax highlighting plugin such as the <a href=\"https://github.com/antoniotejada/Trilium-SyntaxHighlightWidget\">Trilium-SyntaxHighlightWidget</a> we are basing off of, it is important to disable that plugin before upgrading in order for it not to conflict with our implementation.</p><p>Should you encounter any issues after the migration, try running Trilium in safe mode.</p><h2>Changing the language of a code block</h2><p>Simply click anywhere inside the code block and press again the code block button in the <a class=\"reference-link\" href=\"#root/_help_nRhnJkTT8cPs\">Formatting toolbar</a>:<br><img src=\"{{helpAssets}}/User%20Guide/Note%20Types/Text/Developer-specific%20formatting/Code%20blocks_image.png\"></p><h2>Adjusting the list of languages</h2><p>The code blocks feature shares the list of languages with the <a class=\"reference-link\" href=\"#root/_help_6f9hih2hXXZk\">Code</a> note type.</p><p>The supported languages, and the order in which they are listed, can be adjusted by going to <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> → <em>Code Notes</em> → <em>Available MIME types in the dropdown</em>. See <a class=\"reference-link\" href=\"#root/_help_6f9hih2hXXZk\">Code</a> for how to add, remove and reorder them.</p><p>Note that the list of languages is not immediately refreshed, you'd have to manually <a href=\"#root/_help_s8alTXmpFR61\">refresh the application</a>.</p><h2>Text replacements and ligatures</h2><p><a class=\"reference-link\" href=\"#root/_help_oI7GoyilXXAr\">Automatic replacements</a> are a feature of text notes which converts some character sequences into another and some of them interfere with programming text, such as the conversion of quotes. While in a code block, the automatic replacements <strong>are not effect</strong>. The only way the automatic replacements can interfere is if the text is typed/pasted before being put in a code block.</p><p>A different feature is <em>programming ligatures</em>, which is simply a display affordance which turns <code>!=</code> into <code>≠</code> or <code>-></code> as <code>→</code> . These come from the <a href=\"#root/_help_w4rMEhJsALlA\">font</a>. The underlying text is not actually changed, and copying it out gives you back <code>!=</code> and <code>-></code>.</p><p>Ligatures can be disabled in <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a><em>→ Appearance → Fonts → Programming ligatures.</em></p>","_help_AgjCISero73a": "<figure class=\"image image-style-align-right\"><img style=\"aspect-ratio:199/187;\" src=\"{{helpAssets}}/User%20Guide/Note%20Types/Text/Footnotes_image.png\" width=\"199\" height=\"187\"></figure><p>Footnotes are a good place to insert references to a paragraph or details that are displayed at the bottom of the note.</p><h2>Interaction</h2><ul><li>To insert a new footnote, press <span class=\"tn-icon cke cke-trilium-insert-footnote\"></span> (or press the right arrow and select <em>New footnote</em>).</li><li>To insert a reference to an existing footnote, press the right arrow and select <em>Insert footnote</em>, followed by the number of the footnote to insert.</li><li>Hovering over a reference (e.g. <code>[1]</code>) will display the content of the footnote in a tooltip for easy reference.</li><li>Clicking on a reference in the text (e.g. <code>[1]</code>) will navigate to the corresponding footnote.</li><li>Similarly, clicking on the <code>^</code> button of a footnote will navigate to the corresponding reference in the text.</li></ul>","_help_5wZallV2Qo1t": "<figure class=\"image image-style-align-right\"><img style=\"aspect-ratio:220/76;\" src=\"{{helpAssets}}/User%20Guide/Note%20Types/Text/Format%20Painter_image.png\" width=\"220\" height=\"76\"></figure><p>The Format Painter is a feature in text notes that allows users to copy the formatting of text (such as <strong>bold</strong>, <em>italic</em>, <del>Strikethrough</del>, etc.) and apply it to other parts of the document. It helps maintain consistent formatting and accelerates the creation of rich content.</p><h2>Usage Instructions</h2><p>Click the text that you want to copy the formatting from and use the <em>Copy formatting</em> toolbar button (<span class=\"tn-icon cke cke-paint-roller\"></span>) to copy the style. Then select the target text with your mouse, or click a word, to apply the formatting.</p><ul><li><strong>To copy the formatting</strong>: Place the cursor inside text with some formatting and click the <em>Copy formatting</em> toolbar button. The mouse cursor changes to indicate the painter is armed.</li><li><strong>To paint with the copied formatting</strong>: Select the target text with your mouse. The formatting is applied when you release the button, and the painter disarms — the cursor returns to normal. Clicking or tapping a word applies it to the whole word.</li><li><strong>To paint a selection made otherwise</strong>, such as with the keyboard or the selection handles of a touch screen: select the target text, then use the toolbar button again, which reads <em>Apply formatting</em> once the selection has moved. On a phone, the formatting row stays open while the painter is armed, so the button stays in reach.</li><li><strong>To cancel without painting</strong>: Click the toolbar button again before selecting other text, or press <kbd>Escape</kbd>.</li></ul><h2>Limitations</h2><ol><li>Painting with block-level formatting (like headings or image styles) is not supported yet. This is because, in <a class=\"reference-link\" href=\"#root/_help_MI26XDLSAlCD\">CKEditor</a>, they are considered a part of the content rather than text formatting.</li><li>A click outside a word, such as between two spaces or at the end of a line, only primes the caret, so text you type there takes the copied formatting.</li><li>The painter is one-shot; each paint requires copying the formatting again.</li></ol>",- "_help_nRhnJkTT8cPs": "<p>Trilium allows two different editing experiences for text notes, based on your preference.</p><p>The type of formatting toolbar can be changed by going to <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> and then looking for the <a class=\"reference-link\" href=\"#root/_hidden/_options/_optionsTextNotes\">Text Notes</a> section. In it, look for the <em>Formatting toolbar</em> category.</p><h2>Floating</h2><p>The floating bar is a more minimalist option, in which the formatting is hidden behind two different popups.</p><h3>Block-level popup</h3><p>The first popup is the block-level popup. This will appear to the left of the current paragraph you are currently editing, as a sequence of dots:<br><img src=\"{{helpAssets}}/User%20Guide/Note%20Types/Text/Formatting%20toolbar_image.jpg\"></p><p>Clicking this popup will reveal the formatting options that are specific to the entire paragraph, such as setting a heading, lists, tables, etc.</p><p>The dots are also a drag handle: drag them to move the paragraph, all the selected paragraphs, or a selected element such as an image, a table or an included note to another place in the note. Right-clicking them copies a reference to the paragraph or to the selected paragraphs, see <a class=\"reference-link\" href=\"#root/_help_klC3ilXa9kUE\">Block references</a>.</p><figure class=\"image\"><img style=\"aspect-ratio:1404/156;\" src=\"{{helpAssets}}/User%20Guide/Note%20Types/Text/2_Formatting%20toolbar_image.png\" width=\"1404\" height=\"156\"></figure><h3>Inline popup</h3><p>The inline popup appears automatically when selecting a text:</p><figure class=\"image\"><img style=\"aspect-ratio:1008/154;\" src=\"{{helpAssets}}/User%20Guide/Note%20Types/Text/1_Formatting%20toolbar_image.png\" width=\"1008\" height=\"154\"></figure><p>All the options here apply only to the selected portion of text, such as changing the font size, or making the text bold.</p><h2>Fixed</h2><p>The fixed formatting offers a more traditional editing paradigm, usually useful if a lot of formatting is needed.</p><p>All the options are combined into a single toolbar that will appear at the above the note. When using <a class=\"reference-link\" href=\"#root/_help_luNhaphA37EO\">Split View</a>, a single toolbar will be available to save space and it acts on the active note.</p><p>The sequence of dots to the left of the current paragraph is still shown, but only as a drag handle: drag it to move the paragraph, all the selected paragraphs, or a selected element such as an image, a table or an included note to another place in the note. Clicking it does not open a popup, and right-clicking it copies a reference to the block, see <a class=\"reference-link\" href=\"#root/_help_klC3ilXa9kUE\">Block references</a>. The drag handle is not shown in the mobile layout.</p><figure class=\"image\"><img style=\"aspect-ratio:1440/60;\" src=\"{{helpAssets}}/User%20Guide/Note%20Types/Text/Formatting%20toolbar_image.png\" width=\"1440\" height=\"60\"></figure><p>By default, if the toolbar does not fit on the screen, the rest of the options will be grouped into a single option at the end. It is possible to display items on multiple lines by checking the corresponding option in the <em>Formatting toolbar</em> section.</p>",+ "_help_nRhnJkTT8cPs": "<p>Trilium allows two different editing experiences for text notes, based on your preference.</p><p>The type of formatting toolbar can be changed by going to <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> and then looking for the <a class=\"reference-link\" href=\"#root/_hidden/_options/_optionsTextNotes\">Text Notes</a> section. In it, look for the <em>Formatting toolbar</em> category.</p><h2>Floating</h2><p>The floating bar is a more minimalist option, in which the formatting is hidden behind two different popups.</p><h3>Block-level popup</h3><p>The first popup is the block-level popup. This will appear to the left of the current paragraph you are currently editing, as a sequence of dots:<br><img src=\"{{helpAssets}}/User%20Guide/Note%20Types/Text/Formatting%20toolbar_image.jpg\"></p><p>Clicking this popup will reveal the formatting options that are specific to the entire paragraph, such as setting a heading, lists, tables, etc.</p><p>The dots are also a drag handle: drag them to move the paragraph, all the selected paragraphs, or a selected element such as an image, a table or an included note to another place in the note. Right-clicking them copies a reference to the paragraph or to the selected paragraphs, see <a class=\"reference-link\" href=\"#root/_help_klC3ilXa9kUE\">Block references</a>.</p><figure class=\"image\"><img style=\"aspect-ratio:1404/156;\" src=\"{{helpAssets}}/User%20Guide/Note%20Types/Text/2_Formatting%20toolbar_image.png\" width=\"1404\" height=\"156\"></figure><h3>Inline popup</h3><p>The inline popup appears automatically when selecting a text:</p><figure class=\"image\"><img style=\"aspect-ratio:1008/154;\" src=\"{{helpAssets}}/User%20Guide/Note%20Types/Text/1_Formatting%20toolbar_image.png\" width=\"1008\" height=\"154\"></figure><p>All the options here apply only to the selected portion of text, such as changing the font size, or making the text bold.</p><h2>Fixed</h2><p>The fixed formatting offers a more traditional editing paradigm, usually useful if a lot of formatting is needed.</p><p>All the options are combined into a single toolbar that will appear at the above the note. When using <a class=\"reference-link\" href=\"#root/_help_luNhaphA37EO\">Split View</a>, a single toolbar will be available to save space and it acts on the active note.</p><p>The sequence of dots to the left of the current paragraph is still shown, but only as a drag handle: drag it to move the paragraph, all the selected paragraphs, or a selected element such as an image, a table or an included note to another place in the note. Releasing it above the first paragraph or below the last one moves it to the start or the end of the note. Clicking it does not open a popup, and right-clicking it copies a reference to the block, see <a class=\"reference-link\" href=\"#root/_help_klC3ilXa9kUE\">Block references</a>. Hovering the drag handle shades the blocks that it moves: inside a table, this is the paragraph in the current cell, and with several cells selected, the whole table. The drag handle is not shown in the mobile layout.</p><figure class=\"image\"><img style=\"aspect-ratio:1440/60;\" src=\"{{helpAssets}}/User%20Guide/Note%20Types/Text/Formatting%20toolbar_image.png\" width=\"1440\" height=\"60\"></figure><p>By default, if the toolbar does not fit on the screen, the rest of the options will be grouped into a single option at the end. It is possible to display items on multiple lines by checking the corresponding option in the <em>Formatting toolbar</em> section.</p>","_help_Gr6xFaF6ioJ5": "<h2>Headings</h2><figure class=\"image image-style-align-right\"><img style=\"aspect-ratio:255/284;\" src=\"{{helpAssets}}/User%20Guide/Note%20Types/Text/2_General%20formatting_image.png\" width=\"255\" height=\"284\"></figure><p>Trilium provides headings to define sections within text. Headings are numbered from 2 to 6.</p><p>The reason why Heading 1 is missing from the list is that it is being reserved for the title of note.</p><p>To turn a heading back into a normal text, select <em>Paragraph</em> from the list.</p><p>Apart from using the UI, it is also possible to quickly insert headings using the Markdown-like shortcuts:</p><ul><li><code>##</code> for Heading 2</li><li><code>###</code> for Heading 3</li><li><code>####</code> for Heading 4</li><li><code>#####</code> for Heading 5</li><li><code>######</code> for Heading 6</li></ul><h2>Font size</h2><figure class=\"image image-style-align-right\"><img style=\"aspect-ratio:363/249;\" src=\"{{helpAssets}}/User%20Guide/Note%20Types/Text/General%20formatting_image.png\" width=\"363\" height=\"249\"></figure><p>One way to highlight a portion of text is to increase the size of the font.</p><p>To do so, select some text and choose an option from the <em>Font size</em> (<span class=\"tn-icon cke cke-font-size\"></span>) selector (as pictured to the right).</p><p>Unlike other text editors such as Microsoft Word, the font size is relative (i.e. “Tiny”, “Small” instead of a number like 12).</p><p>Avoid using this feature just to simply make all text bigger. In that case it's generally better to adjust the font size for all notes in <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> or by zooming.</p><h2>Bold, italic, underline, strike-through</h2><figure class=\"image image-style-align-right\"><img style=\"aspect-ratio:215/71;\" src=\"{{helpAssets}}/User%20Guide/Note%20Types/Text/3_General%20formatting_image.png\" width=\"215\" height=\"71\"></figure><p>Text can be formatted as <strong>Bold,</strong> <em>Italic,</em> Underline or <del>Strike-through</del> via the dedicated buttons (<span class=\"tn-icon cke cke-bold\"></span>, <span class=\"tn-icon cke cke-italic\"></span>, <span class=\"tn-icon cke cke-underline\"></span>, <span class=\"tn-icon cke cke-strikethrough\"></span>) in the formatting toolbar.</p><p>This formatting can be easily removed using the <em>Remove formatting</em> (<span class=\"tn-icon cke cke-remove-format\"></span>) item.</p><p>The following keyboard shortcuts can be used here:</p><ul><li><kbd>Ctrl</kbd>+<kbd>B</kbd> for bold</li><li><kbd>Ctrl</kbd>+<kbd>I</kbd> for italic</li><li><kbd>Ctrl</kbd>+<kbd>U</kbd> for underline</li></ul><p>Alternatively, Markdown-like formatting can be used:</p><ul><li><strong>Bold</strong>: Type <code>**text**</code> or <code>__text__</code></li><li><em>Italic</em>: Type <code>*text*</code> or <code>_text_</code></li><li><del>Strikethrough</del>: Type <code>~~text~~</code></li></ul><h2>Superscript, subscript</h2><p>This allows writing superscript or subscript text.</p><p>This is mostly useful for units of measure (e.g. cm3 for cubic centimeters) and chemical notations (e.g. NaHCO3)</p><p>For mathematical formulas, prefer the <a class=\"reference-link\" href=\"#root/_help_YfYAtQBcfo5V\">Math Equations</a> feature instead.</p><h2>Font color and background color</h2><figure class=\"image image-style-align-right\"><img style=\"aspect-ratio:167/204;\" src=\"{{helpAssets}}/User%20Guide/Note%20Types/Text/1_General%20formatting_image.png\" width=\"167\" height=\"204\"></figure><p>Selected text can be colored with one of the predefined colors from a palette or any color can be selected using the color picker (<span class=\"tn-icon cke cke-color-palette\"></span>).</p><p>Once there is at least one color defined in the document, it will appear in the list for easy reuse.</p><p>Colors adapt to the <a href=\"#root/_help_Wy267RK4M69c\">theme</a>. Trilium shows each color in a lighter or darker shade that suits the current theme, so the text stays readable after switching between light and dark themes. The hue stays the same: red text is red in both themes, only lighter or darker. This applies to the palette, the color picker and the document colors alike, and to shared notes too. Printed notes and PDF exports always use the shades of light themes, which suit white paper. The note itself keeps the color as it was picked, so an exported note shows it unchanged.</p><p>Colors applied with older versions of Trilium are shown exactly as they were picked, until the note is next edited.</p><p>Older browsers that can't adapt colors show them exactly as they were picked.</p><p>When you paste text copied from a web page in Chrome, Edge or a Chromium-based app (such as Visual Studio Code), Trilium removes the page's styling:</p><ul><li>Text and background colors.</li><li>Fonts and font sizes.</li><li>Table borders, backgrounds and spacing.</li></ul><p>The following formatting is preserved:</p><ul><li>Bold, italic, underline and strikethrough.</li><li>Subscript and superscript.</li><li>Links, code and tables.</li></ul><p>Colors are preserved when pasting from Word, Google Docs or another note.</p><p>To remove either the background or foreground color of a text, select the corresponding formatting button (<span class=\"tn-icon cke cke-font-color\"></span> or <span class=\"tn-icon cke cke-font-background\"></span>) and press <em>Remove color</em> (<span class=\"tn-icon cke cke-eraser\"></span>) or use the <em>Remove formatting</em> (<span class=\"tn-icon cke cke-remove-format\"></span>) toolbar item.</p><h2>Remove formatting</h2><p>The <span class=\"tn-icon cke cke-remove-format\"></span> <em>Remove formatting</em> button is a quick way to eliminate the general formatting styling of a particular text.</p><p>Simply select the text and press the button to remove the formatting (bold, italic, colors, sizes, etc.). If the text does not have any removable formatting, the button will appear disabled.</p><p>Note that heading styles are not taken into consideration, these must be manually changed back to a paragraph according to the <em>Headings</em> section.</p><p>When pasting content that comes with undesired formatting, an alternative to pasting and then removing formatting is pasting as plain text via <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>V</kbd>.</p><h2>Format painter</h2><p>The <a class=\"reference-link\" href=\"#root/_help_5wZallV2Qo1t\">Format Painter</a> allows users to copy the formatting of text (such as bold, italic, Strikethrough, etc.) and apply it to other parts of the document. It helps maintain consistent formatting and accelerates the creation of rich content.</p><h2>Support for Markdown</h2><p>When exported to <a class=\"reference-link\" href=\"#root/_help_Oau6X9rCuegd\">Markdown</a>, most of the general formatting is maintained such as headings, bold, italic, underline, etc.</p>","_help_AxshuNRegLAv": "<aside class=\"admonition note\"><p>This page has been relocated to <a class=\"reference-link\" href=\"#root/_help_2dcGDhp9WFKb\">Outline tab</a>.</p></aside>",- "_help_mT0HEkOsz6i1": "<p>Trilium supports storing and displaying images. Supported formats are PNG, JPEG, GIF, BMP, WebP, AVIF and SVG.</p><p>An image can be uploaded in the form of note's <a href=\"#root/_help_0vhv7lsOLy82\">attachment</a> or as a standalone <a href=\"#root/_help_kBrnXNG3Hplm\">note</a> placed into the <a href=\"#root/_help_kBrnXNG3Hplm\">note tree</a>. Its reference can be copied into a text note, in order to display it in the text itself.</p><h2>Uploading images</h2><p>To add an image to the note:</p><ul><li>Simply drag it from file explorer onto the note editor inside Trilium and the image will be uploaded.</li><li>Alternatively, in the <a class=\"reference-link\" href=\"#root/_help_nRhnJkTT8cPs\">Formatting toolbar</a>, press the <span class=\"tn-icon cke cke-paper-clip\"></span><em>Attach file</em> button and select <em>Image</em>.</li><li>On the <a class=\"reference-link\" href=\"#root/_help_RDslemsQ6gCp\">Mobile Frontend</a>, the same menu also offers <em>Camera</em>, which takes a photo and inserts it.</li><li>You can also copy and paste an image from web (see section below).</li></ul><aside class=\"admonition tip\"><p>To link a picture instead of displaying it, attach it with <em>Attach file as a link</em>, from the <span class=\"tn-icon cke cke-paper-clip\"></span><em>Attach file</em> button. See <a class=\"reference-link\" href=\"#root/_help_0vhv7lsOLy82\">Attachments</a>.</p></aside><h2>Clipboard & automatic download of images</h2><p>Trilium has a special handling for images copied to and pasted from the clipboard.</p><ul><li>For a mix of text and images, the images are downloaded automatically by the server (or desktop app, depending on what is being used).<ul><li>This means that the image must be publicly accessible and reachable from wherever Trilium is running. Inaccessible images will end up as broken images.</li></ul></li><li>If a single image is pasted into Trilium, it will prefer the image that comes in the clipboard. This makes it possible to copy images that Trilium would not otherwise be able to reach, such as Google Chat, Slack, etc.</li><li>When a text with images is copied from Trilium and pasted in another app (such as Microsoft Word or LibreOffice Writer), the images will be preserved.</li></ul><p>The automatic download of images is enabled by default and can be toggled from <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> → <em>Media</em> → <em>Download images automatically.</em></p><h2>Configuring the images</h2><p>Clicking on an image will reveal a popup with multiple options:<br><img src=\"{{helpAssets}}/User%20Guide/Note%20Types/Text/Images_image.png\"></p><h3>Alignment</h3><p>The first button of the popup, <em>Image position</em>, shows the icon of the image's current position. It opens a menu that groups the positions by how text runs around the image:</p><figure class=\"table\"><table><thead><tr><th>Icon</th><th>Option</th><th>Preview</th><th>Description</th></tr></thead><tbody><tr><td><span class=\"tn-icon cke cke-object-inline\"></span></td><td><em>In line</em></td><td><img src=\"{{helpAssets}}/User%20Guide/Note%20Types/Text/Images_image.jpg\"></td><td>The image sits inside a paragraph, like a large character, and moves with the text around it. Use drag & drop or cut-paste to move it around.</td></tr><tr><td><span class=\"tn-icon cke cke-object-center\"></span></td><td><em>Break text</em> → <em>Align left</em>, <em>Align center</em> or <em>Align right</em></td><td><img src=\"{{helpAssets}}/User%20Guide/Note%20Types/Text/1_Images_image.jpg\"> <img src=\"{{helpAssets}}/User%20Guide/Note%20Types/Text/2_Images_image.jpg\"></td><td>The image is displayed on a line of its own, at the left, in the center or at the right; text continues above and below it but not beside it.</td></tr><tr><td><span class=\"tn-icon cke cke-object-inline-right\"></span></td><td><em>Wrap text</em> → <em>Align left</em> or <em>Align right</em></td><td><img src=\"{{helpAssets}}/User%20Guide/Note%20Types/Text/3_Images_image.jpg\"></td><td>The image is displayed at the left or the right, and the text flows beside it.</td></tr></tbody></table></figure><h3>Drawing over an image</h3><p>To draw or write over an image, press the <span class=\"tn-icon bx bxs-pen\"></span> <em>Convert image to a drawing canvas</em> button of its toolbar. The image becomes a drawing canvas that shows all of it, locked in place. See the drawing canvases section of <a class=\"reference-link\" href=\"#root/_help_nBAXQFj20hS1\">Include Note</a>.</p><h2>Compression</h2><p>Since Trilium isn't really meant to be primary storage for image data, it attempts to compress and resize (with pretty aggressive settings) uploaded images before storing them to the database. You may then notice some quality degradation. Basic quality settings is available in <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> → <em>Media</em>.</p><p>If you want to save images in their original resolution, it is recommended to save them as attachment to note (look for the contextual menu in <a class=\"reference-link\" href=\"#root/_help_8YBEPzcpUgxw\">Note menu</a> → <em>Import files</em>).</p><h2>Aligning images side-by-side</h2><p>There are generally two ways to display images side by side:</p><ul><li>If they are roughly the same size, simply make the two images in-line, according to the alignment section above. The images can be dragged & dropped onto the same line.</li><li>If they are on different size, create a <a href=\"#root/_help_NdowYOC1GFKS\">table</a> with invisible borders.</li></ul>",+ "_help_mT0HEkOsz6i1": "<p>Trilium supports storing and displaying images. Supported formats are PNG, JPEG, GIF, BMP, WebP, AVIF and SVG.</p><p>An image can be uploaded in the form of note's <a href=\"#root/_help_0vhv7lsOLy82\">attachment</a> or as a standalone <a href=\"#root/_help_kBrnXNG3Hplm\">note</a> placed into the <a href=\"#root/_help_kBrnXNG3Hplm\">note tree</a>. Its reference can be copied into a text note, in order to display it in the text itself.</p><h2>Uploading images</h2><p>To add an image to the note:</p><ul><li>Simply drag it from file explorer onto the note editor inside Trilium and the image will be uploaded.</li><li>Alternatively, in the <a class=\"reference-link\" href=\"#root/_help_nRhnJkTT8cPs\">Formatting toolbar</a>, press the <span class=\"tn-icon cke cke-paper-clip\"></span><em>Attach file</em> button and select <em>Image</em>.</li><li>On the <a class=\"reference-link\" href=\"#root/_help_RDslemsQ6gCp\">Mobile Frontend</a>, the same menu also offers <em>Camera</em>, which takes a photo and inserts it.</li><li>You can also copy and paste an image from web (see section below).</li></ul><p>Where the image goes depends on the cursor. In an empty paragraph, the image is displayed on a line of its own. In a list item, or after some text in a paragraph, the image is inserted <em>In line</em>, inside the text. To change it afterwards, use the <em>Image position</em> button described in the alignment section below.</p><aside class=\"admonition tip\"><p>To link a picture instead of displaying it, attach it with <em>Attach file as a link</em>, from the <span class=\"tn-icon cke cke-paper-clip\"></span><em>Attach file</em> button. See <a class=\"reference-link\" href=\"#root/_help_0vhv7lsOLy82\">Attachments</a>.</p></aside><h2>Clipboard & automatic download of images</h2><p>Trilium has a special handling for images copied to and pasted from the clipboard.</p><ul><li>For a mix of text and images, the images are downloaded automatically by the server (or desktop app, depending on what is being used).<ul><li>This means that the image must be publicly accessible and reachable from wherever Trilium is running. Inaccessible images will end up as broken images.</li></ul></li><li>If a single image is pasted into Trilium, it will prefer the image that comes in the clipboard. This makes it possible to copy images that Trilium would not otherwise be able to reach, such as Google Chat, Slack, etc.</li><li>When a text with images is copied from Trilium and pasted in another app (such as Microsoft Word or LibreOffice Writer), the images will be preserved.</li></ul><p>The automatic download of images is enabled by default and can be toggled from <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> → <em>Media</em> → <em>Download images automatically.</em></p><h2>Configuring the images</h2><p>Clicking on an image will reveal a popup with multiple options:<br><img src=\"{{helpAssets}}/User%20Guide/Note%20Types/Text/Images_image.png\"></p><h3>Alignment</h3><p>The first button of the popup, <em>Image position</em>, shows the icon of the image's current position. It opens a menu that groups the positions by how text runs around the image:</p><figure class=\"table\"><table><thead><tr><th>Icon</th><th>Option</th><th>Preview</th><th>Description</th></tr></thead><tbody><tr><td><span class=\"tn-icon cke cke-object-inline\"></span></td><td><em>In line</em></td><td><img src=\"{{helpAssets}}/User%20Guide/Note%20Types/Text/Images_image.jpg\"></td><td>The image sits inside a paragraph, like a large character, and moves with the text around it. Use drag & drop or cut-paste to move it around.</td></tr><tr><td><span class=\"tn-icon cke cke-object-center\"></span></td><td><em>Break text</em> → <em>Align left</em>, <em>Align center</em> or <em>Align right</em></td><td><img src=\"{{helpAssets}}/User%20Guide/Note%20Types/Text/1_Images_image.jpg\"> <img src=\"{{helpAssets}}/User%20Guide/Note%20Types/Text/2_Images_image.jpg\"></td><td>The image is displayed on a line of its own, at the left, in the center or at the right; text continues above and below it but not beside it.</td></tr><tr><td><span class=\"tn-icon cke cke-object-inline-right\"></span></td><td><em>Wrap text</em> → <em>Align left</em> or <em>Align right</em></td><td><img src=\"{{helpAssets}}/User%20Guide/Note%20Types/Text/3_Images_image.jpg\"></td><td>The image is displayed at the left or the right, and the text flows beside it.</td></tr></tbody></table></figure><h3>Drawing over an image</h3><p>To draw or write over an image, press the <span class=\"tn-icon bx bxs-pen\"></span> <em>Convert image to a drawing canvas</em> button of its toolbar. The image becomes a drawing canvas that shows all of it, locked in place. See the drawing canvases section of <a class=\"reference-link\" href=\"#root/_help_nBAXQFj20hS1\">Include Note</a>.</p><h2>Compression</h2><p>Since Trilium isn't really meant to be primary storage for image data, it attempts to compress and resize (with pretty aggressive settings) uploaded images before storing them to the database. You may then notice some quality degradation. Basic quality settings is available in <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> → <em>Media</em>.</p><p>If you want to save images in their original resolution, it is recommended to save them as attachment to note (look for the contextual menu in <a class=\"reference-link\" href=\"#root/_help_8YBEPzcpUgxw\">Note menu</a> → <em>Import files</em>).</p><h2>Aligning images side-by-side</h2><p>There are generally two ways to display images side by side:</p><ul><li>If they are roughly the same size, simply make the two images in-line, according to the alignment section above. The images can be dragged & dropped onto the same line.</li><li>If they are on different size, create a <a href=\"#root/_help_NdowYOC1GFKS\">table</a> with invisible borders.</li></ul>","_help_0Ofbk1aSuVRu": "<figure class=\"image image-style-align-right image_resized\" style=\"width:50.47%;\"><img style=\"aspect-ratio:880/553;\" src=\"{{helpAssets}}/User%20Guide/Note%20Types/Text/Images/Image%20references_image.png\" width=\"880\" height=\"553\"></figure><p>Image references are an easy way to embed the preview of another note type into a <a class=\"reference-link\" href=\"#root/_help_iPIMuisry3hd\">Text</a> note.</p><h2>Supported note types</h2><ul><li><a class=\"reference-link\" href=\"#root/_help_grjYqerjn243\">Canvas</a></li><li><a class=\"reference-link\" href=\"#root/_help_s1aBHPd79XYj\">Mermaid Diagrams</a></li><li><a class=\"reference-link\" href=\"#root/_help_gBbsAeiuUxI5\">Mind Map</a></li></ul><h2>Steps</h2><ol><li>Go to one of the supported notes (listed above) and look for the <span class=\"tn-icon bx bx-copy\"></span> button in the <a class=\"reference-link\" href=\"#root/_help_1P8QXI5edXNd\">Note buttons</a> area.</li><li>Go to a <a class=\"reference-link\" href=\"#root/_help_iPIMuisry3hd\">Text</a> note and use the Paste function to insert the reference to that note.</li></ol><h2>Interaction</h2><ul><li>Double-clicking an image reference from a text note will automatically open the target note.</li><li>Clicking an image reference while <kbd>Ctrl</kbd> is pressed will open the target note in a new tab.</li><li>Modifying the target note should also update the image reference. If that doesn't happen, consider <a class=\"reference-link\" href=\"#root/_help_s8alTXmpFR61\">Refreshing the application</a>.</li></ul>","_help_VRoP0g1uHHc2": "<figure class=\"image image-style-align-center image_resized\" style=\"width:76.29%;\"><img style=\"aspect-ratio:1479/865;\" src=\"{{helpAssets}}/User%20Guide/Note%20Types/Text/In-editor%20AI%20assistant_image.png\" width=\"1479\" height=\"865\"></figure><p>The AI assistant works on the text you are already writing: select a passage and have it rewritten, translated or turned into a table, or ask for new content at the cursor. Unlike the <a href=\"#root/_help_LrKznOtw9cQD\">AI chat</a>, it does not open a conversation window, the result is previewed in place and only enters the note when you accept it.</p><h2>Requirements</h2><p>The assistant is only available once at least one provider is configured in <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> → <em>AI / LLM</em>, with at least one model selected for it. Until then the toolbar entry is not shown at all.</p><h2>Accessing the AI assistant</h2><p>To access the AI assistant:</p><ul><li>Look for the <span class=\"tn-icon cke cke-trilium-ai\"></span> button in the <a class=\"reference-link\" href=\"#root/_help_nRhnJkTT8cPs\">Formatting toolbar</a>. Press the button itself to enter the <em>Ask AI</em> mode or press the arrow key next to it to access the quick commands and the model selection. On a phone, the button has no arrow: tapping it opens the same menu at the bottom of the screen, with <em>Ask AI…</em> at its top, and a group such as <em>Translate</em> opens as a page of its own.</li><li>Look for <em>AI assistant</em> or any of the <em>AI</em>-prefixed quick commands in <a class=\"reference-link\" href=\"#root/_help_ZlN4nump6EbW\">Slash Commands</a>.</li><li>Press <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>K</kbd>.</li><li>Select a text and choose the <em>AI assistant</em> option in the <a class=\"reference-link\" href=\"#root/_help_jcQVxzYybYgz\">Note contextual menu</a>.</li></ul><h2>What the assistant works on</h2><figure class=\"table\"><table><thead><tr><th>Situation</th><th>What is sent</th></tr></thead><tbody><tr><td>Text is selected</td><td>The selection.</td></tr><tr><td>Nothing is selected, and you pick a quick action</td><td>The paragraph the cursor is in.</td></tr><tr><td>Nothing is selected, and you type your own prompt</td><td>Nothing, the response is new content written at the cursor.</td></tr></tbody></table></figure><p>In all cases the assistant also sends the text before and after the target, so that the model can tell what it is writing into: asked to <em>Continue writing</em> or to summarize, a model that can only see the selected words is guessing at the document around them. This surrounding text is context only, it is never rewritten.</p><aside class=\"admonition important\"><p>That means a single run sends more than the passage you highlighted. See <a class=\"reference-link\" href=\"#root/_help_cRRrdZjgyhNc\">Privacy</a> for exactly what leaves your machine.</p></aside><h2>Quick actions</h2><p>The arrow beside the toolbar button opens a menu of ready-made instructions, grouped by what they do.</p><ul><li>The <em>Reformat</em> actions produce real Trilium content rather than plain text: <em>Diagram</em> inserts a Mermaid diagram, <em>Callout</em> an admonition, and <em>Collapsible</em> a collapsible block.</li><li>The <em>Translate</em> group lists the <a href=\"#root/_help_veGu4faJErEM\">content languages</a> you have enabled, or a predefined list if no content languages are set. It can be filled from within the editor, the last entry of the submenu opens the language configuration directly.</li></ul><p>Actions that need something to work on are greyed out when there is nothing to work on (for example an empty paragraph with no selection).</p><h2>Asking for something specific</h2><p>Choosing <em>Ask AI…</em> (<span class=\"tn-icon bx bx-message-square-dots\"></span>) opens a prompt where you can describe the change in your own words, for example: \"make this less formal\", \"add a row for 2024\", \"write an intro paragraph for this section\". Press <kbd>Enter</kbd> or the <span class=\"tn-icon cke cke-arrow-up\"></span> send button to run it.</p><p>Once a response arrives you can keep going in the same prompt, and the assistant treats it as a conversation rather than as a fresh request: after <em>Translate this to German</em>, asking for <em>make it shorter</em> shortens the German, not the original.</p><h2>Reviewing the result</h2><p>The response streams in as it is generated, and can be interrupted at any point by pressing the <em>Stop</em> (<span class=\"tn-icon cke cke-stop\"></span>) button; whatever arrived before that stays usable.</p><p>Nothing is written into the note until you say so. The review offers:</p><ul><li><em>Result</em>, which displays the response as it will be inserted.</li><li><em>Changes</em>, which displays an inline diff against the original, with insertions and deletions marked. When the model rewrote the passage rather than editing it, the review opens on <em>Result</em> instead: a diff of two texts with little in common is harder to read than the answer itself.</li><li><em>Try again</em> (<span class=\"tn-icon cke cke-refresh\"></span>), to re-run the same instruction.</li><li><em>Replace</em>, which substitutes the original passage</li><li><em>Insert below</em>, which keeps the original and adds the response after it.</li></ul><p>Trilium also reports the model that produced it, the tokens consumed and, for providers that report it, the price.</p><p>If you ask for a correction and there is nothing to correct, the assistant will indicate it instead of showing a blank diff.</p><h2>Choosing the model</h2><p>The bottom of the quick actions menu shows which model the assistant runs on, and lets you pick another from the models you selected in <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> → <em>AI / LLM</em>, grouped by provider.</p><p>The model can also be changed while asking for something specific, or after the assistant has generated its response (i.e. if the response needs a better model).</p><p>This choice is separate from the model used by the chat, and is remembered across notes and devices. Left unset, the assistant follows the first configured provider.</p>","_help_mVEYwt20exhO": "<p><em>Quick actions</em> are a feature of the <a class=\"reference-link\" href=\"#root/_help_VRoP0g1uHHc2\">In-editor AI assistant</a> for <a class=\"reference-link\" href=\"#root/_help_iPIMuisry3hd\">Text</a> notes which automatically triggers an LLM suggestion based on a defined prompt. The built-in quick actions come with a predefined prompt, but it is also possible to define your own quick actions.</p><h2>Creating a custom quick action</h2><p>In the <a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a>: </p><ol><li>Right-click the note where you want to place the quick action.</li><li>Select <em>Insert child note</em>.</li><li>Select <em>More</em> → <em>AI Quick Action</em>. The entry appears only when AI is enabled.</li></ol><p>Afterwards, simply type in the content of the note the desired prompt. The text can be formatted in the same manner as a normal text note and it will be passed to the LLM as Markdown.</p><p>The title of the note will become the title of the quick action.</p><p>Of note:</p><ul><li><a class=\"reference-link\" href=\"#root/_help_6f9hih2hXXZk\">Code</a> notes work too.</li><li>An empty note is ignored.</li><li><a class=\"reference-link\" href=\"#root/_help_MKmLg5x6xkor\">Archived Notes</a> are also excluded.</li></ul><h2>Using a quick action</h2><p>Once a quick action is defined, the action will appear under the <em>Quick Actions</em> dropdown in a group called <em>Custom</em>.</p>",diff --cc packages/ckeditor5/src/plugins/block_drag_handle.spec.tsindex b0de2f215a,4c23e8fc64..429ec63d45--- a/packages/ckeditor5/src/plugins/block_drag_handle.spec.ts+++ b/packages/ckeditor5/src/plugins/block_drag_handle.spec.ts@@@ -357,83 -500,30 +555,107 @@@ async function createEditorreturn { editor, button };}+/**+ * Creates an editor of 40 paragraphs in a scrolled box, as the note pane holds it, with the+ * selection in the paragraph at `index`.+ */+async function createScrolledEditor(index: number) {+ const paragraphs = Array.from({ length: 40 }, (_, paragraphIndex) => (+ paragraphIndex === index ? "<paragraph>bl[]ock</paragraph>" : "<paragraph>text</paragraph>"+ ));+ const { editor, button } = await createEditor(paragraphs.join(""));+ const scroller = document.createElement("div");+ scroller.style.setProperty("height", "200px");+ scroller.style.setProperty("overflow", "auto");+ document.body.prepend(scroller);+ onTestFinished(() => scroller.remove());++ const editorElement = editor.ui.view.element;+ if (editorElement) {+ scroller.append(editorElement);+ }+ editor.editing.view.focus();+ await expect.poll(() => editor.ui.focusTracker.isFocused).toBe(true);+ editor.ui.update();++ return { editor, button, scroller };+}++/** Scrolls `scroller` to `top` and waits for the frame in which the handle follows. */+async function scrollTo(scroller: HTMLElement, top: number) {+ if (Math.round(scroller.scrollTop) === top) {+ throw new Error(`The box is already scrolled to ${top}.`);+ }++ const scrolled = new Promise((resolve) => {+ scroller.addEventListener("scroll", resolve, { once: true });+ });+ scroller.scrollTop = top;+ await scrolled;+ await new Promise(requestAnimationFrame);+}++/**+ * Lists the layout reads of `BlockDragHandle` that follow a change to `button`: each makes the+ * browser compute style and layout again within the frame.+ */+function watchForcedLayouts(button: HTMLElement) {+ const forcedLayouts: string[] = [];+ const observer = new MutationObserver(() => undefined);+ observer.observe(button, { attributes: true });+ const readers = [+ { owner: Element.prototype, name: "getBoundingClientRect" },+ { owner: Element.prototype, name: "getClientRects" },+ { owner: window, name: "getComputedStyle" }+ ] as const;+ for (const { owner, name } of readers) {+ const read = owner[name] as (...args: unknown[]) => unknown;+ Object.defineProperty(owner, name, {+ configurable: true,+ writable: true,+ value(this: unknown, ...args: unknown[]) {+ if (new Error().stack?.includes("/block_drag_handle.ts")) {+ const changes = observer.takeRecords().map((record) => record.attributeName);+ if (changes.length) {+ forcedLayouts.push(`${name} after a change to ${changes.join(", ")}`);+ }+ }+ return read.apply(this, args);+ }+ });+ onTestFinished(() => {+ Object.defineProperty(owner, name, { configurable: true, writable: true, value: read });+ });+ }+ onTestFinished(() => observer.disconnect());++ return forcedLayouts;+}++ /**+ * Moves the editor into a scrolling container, between an element above it and one below it, as+ * a note's title and the space after its content surround it. Returns the two elements' rectangles.+ */+ function placeInScrollingContainer(editor: ClassicEditor) {+ const editorElement = editor.ui.view.element;+ if (!editorElement) {+ throw new Error("The editor is not rendered.");+ }++ const scrollable = document.createElement("div");+ const above = document.createElement("div");+ const below = document.createElement("div");+ scrollable.style.setProperty("overflow-y", "auto");+ above.style.setProperty("height", "40px");+ below.style.setProperty("height", "40px");+ editorElement.before(scrollable);+ scrollable.append(above, editorElement, below);+ scrollable.scrollIntoView();+ onTestFinished(() => scrollable.remove());++ return { above: above.getBoundingClientRect(), below: below.getBoundingClientRect() };+ }+/** Whether `button` is left of the editable, level with the first line of the block at `index`. */function isBesideBlock(editor: ClassicEditor, button: HTMLElement, index: number) {const buttonRect = button.getBoundingClientRect();diff --cc packages/ckeditor5/src/plugins/block_drag_handle.tsindex dcae4cdce7,3e30089f3b..485faaf98c--- a/packages/ckeditor5/src/plugins/block_drag_handle.ts+++ b/packages/ckeditor5/src/plugins/block_drag_handle.ts@@@ -12,10 -18,10 +18,12 @@@ export default class BlockDragHandle exbuttonView?: BlockButtonView;private isDragging = false;+ private isHovered = false;private isUpdateScheduled = false;+ private buttonSize?: { width: number; height: number };+ private targets: ViewElement[] = [];private readonly domEmitter = new (DomEmitterMixin())();+ private readonly layoutEmitter = new (DomEmitterMixin())();static get pluginName() {return "BlockDragHandle" as const;@@@ -124,15 -112,61 +139,55 @@@}const target = this.getTarget();- if (!target) {+ const position = target && this.findPosition(buttonView, buttonView.element, target);+ if (!position) {buttonView.isVisible = false;+ this.updateTargets();return;}- // The button must be visible before it can be measured.+ buttonView.top = position.top;+ buttonView.left = position.left;buttonView.isVisible = true;- const buttonRect = this.placeButton(buttonView, buttonView.element, target);-- // Hide the handle when its block scrolls out of the visible part of the editable.- const visibleRect = new Rect(target.domEditable).getVisible();- const buttonCenter = buttonRect.top + buttonRect.height / 2;- buttonView.isVisible = !!visibleRect- && buttonCenter >= visibleRect.top- && buttonCenter <= visibleRect.bottom;+ this.updateTargets();+ }++ /** Tints the blocks that a drag moves while the pointer is over the visible handle. */+ private updateTargets() {+ const view = this.editor.editing.view;+ // `view.change()` throws during rendering, and the `layoutChanged` after it updates again.+ if (view.isRenderingInProgress) {+ return;+ }++ const isShown = this.isHovered && !this.isDragging && !!this.buttonView?.isVisible;+ const range = isShown ? getDraggedRange(this.editor.model) : null;+ const targets = range ? this.toViewElements(range) : [];+ const previous = this.targets;+ if (targets.length === previous.length+ && targets.every((target, index) => target === previous[index])) {+ return;+ }++ // Set before the change, whose rendering calls `update()` again.+ this.targets = targets;+ view.change((writer) => {+ for (const target of previous) {+ writer.removeClass(TARGET_CLASS, target);+ }+ for (const target of targets) {+ writer.addClass(TARGET_CLASS, target);+ }+ });+ }++ /** The editing view elements of the outermost nodes in `range`. */+ private toViewElements(range: ModelRange) {+ const mapper = this.editor.editing.mapper;+ return Array.from(range.getItems({ shallow: true }))+ .filter((item) => item.is("element"))+ .map((element) => mapper.toViewElement(element))+ .filter((element) => element !== undefined);}private getTarget(): BlockTarget | null {