Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(mobile): mark clones and shared notes in the tree
Elian Doran16e0a9aa3f2a
diff --git a/apps/client/src/entities/fnote.spec.ts b/apps/client/src/entities/fnote.spec.tsindex 4d64aad5e0..9644d05fd0 100644--- a/apps/client/src/entities/fnote.spec.ts+++ b/apps/client/src/entities/fnote.spec.ts@@ -194,6 +194,31 @@ describe("FNote branches & children", () => {expect(child.getParentNotes().map((n) => n.noteId)).toContain(parent.noteId);});+ it("leaves the share root, the bookmarks and saved searches out of the real parents", () => {+ const first = buildNote({ title: "First", children: [ { id: "cloned", title: "Cloned" } ] });+ const cloned = froca.notes["cloned"];+ if (!cloned) throw new Error("expected the cloned note");+ expect(cloned.getRealParentNotes().map((n) => n.noteId)).toEqual([ first.noteId ]);++ const second = buildNote({ title: "Second" });+ const parents = [+ buildNote({ id: "_share", title: "Share" }),+ buildNote({ id: "_lbBookmarks", title: "Bookmarks" }),+ buildNote({ title: "Saved search", type: "search" }),+ second+ ];+ for (const parent of parents) {+ const branchId = `${parent.noteId}_cloned`;+ froca.branches[branchId] = new FBranch(froca, {+ branchId, noteId: "cloned", parentNoteId: parent.noteId, notePosition: 0, fromSearchNote: false+ });+ parent.addChild("cloned", branchId, false);+ cloned.addParent(parent.noteId, branchId, false);+ }++ expect(cloned.getRealParentNotes().map((n) => n.noteId)).toEqual([ first.noteId, second.noteId ]);+ });+it("getChildNotes / getSubtreeNoteIds / getSubtreeNotes traverse the tree and skip archived", async () => {const root = buildNote({title: "root",diff --git a/apps/client/src/entities/fnote.ts b/apps/client/src/entities/fnote.tsindex e42e633a26..6b130f9090 100644--- a/apps/client/src/entities/fnote.ts+++ b/apps/client/src/entities/fnote.ts@@ -213,6 +213,15 @@ export default class FNote {return this.froca.getNotesFromCache(this.parents);}+ /**+ * The parent notes that make this note a clone: the share root, the bookmarks and saved+ * searches also hold the note as a child, but the tree does not count them.+ */+ getRealParentNotes() {+ return this.getParentNotes().filter((parent) =>+ parent.noteId !== "_share" && parent.noteId !== "_lbBookmarks" && parent.type !== "search");+ }+// will sort the parents so that non-search & non-archived are first and archived at the end// this is done so that non-search & non-archived paths are always explored as first when looking for a note pathsortParents() {diff --git a/apps/client/src/services/tree.ts b/apps/client/src/services/tree.tsindex c92abe0a13..8c37c1f248 100644--- a/apps/client/src/services/tree.ts+++ b/apps/client/src/services/tree.ts@@ -3,6 +3,8 @@ import utils from "./utils.js";import froca from "./froca.js";import hoistedNoteService from "./hoisted_note.js";import appContext from "../components/app_context.js";+import type FNote from "../entities/fnote.js";+import { t } from "./i18n.js";export const NOTE_PATH_TITLE_SEPARATOR = " › ";@@ -305,6 +307,15 @@ function isNotePathInHiddenSubtree(notePath: string) {return notePath?.includes("root/_hidden");}+/** Names the other parents of a clone, given its real parents from `FNote.getRealParentNotes()`. */+function getCloneIndicatorTooltip(realParents: FNote[]) {+ if (realParents.length === 2) {+ return t("note_tree.clone-indicator-tooltip-single", { parent: realParents[1].title });+ }+ const parents = realParents.map((p) => p.title).join(", ");+ return t("note_tree.clone-indicator-tooltip", { count: realParents.length, parents });+}+export default {resolveNotePath,resolveNotePathToSegments,@@ -318,5 +329,6 @@ export default {getNotePathTitle,getNoteTitleWithPathAsSuffix,isNotePathInHiddenSubtree,- formatNotePath+ formatNotePath,+ getCloneIndicatorTooltip};diff --git a/apps/client/src/widgets/mobile_widgets/MobileNoteNavigator.css b/apps/client/src/widgets/mobile_widgets/MobileNoteNavigator.cssindex 48d8cabe77..066511b104 100644--- a/apps/client/src/widgets/mobile_widgets/MobileNoteNavigator.css+++ b/apps/client/src/widgets/mobile_widgets/MobileNoteNavigator.css@@ -150,8 +150,26 @@font-size: 1.3em;}-.mobile-navigator-current-title {+.mobile-navigator-title-group {+ display: flex;flex: 1 1 auto;+ align-items: center;+ gap: 6px;+ min-width: 0;+}++.mobile-navigator-indicator {+ flex: 0 0 auto;+ color: var(--muted-text-color, var(--main-text-color));+ opacity: 0.8;++ &.clone-indicator {+ opacity: 0.5;+ }+}++.mobile-navigator-current-title {+ flex: 0 1 auto;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;@@ -301,7 +319,7 @@}.mobile-navigator-row-title {- flex: 1 1 auto;+ flex: 0 1 auto;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;diff --git a/apps/client/src/widgets/mobile_widgets/MobileNoteNavigator.spec.tsx b/apps/client/src/widgets/mobile_widgets/MobileNoteNavigator.spec.tsxindex 7f50bbbe2a..0a5dda123a 100644--- a/apps/client/src/widgets/mobile_widgets/MobileNoteNavigator.spec.tsx+++ b/apps/client/src/widgets/mobile_widgets/MobileNoteNavigator.spec.tsx@@ -1,8 +1,20 @@-import { describe, expect, it } from "vitest";+import { act } from "preact/test-utils";+import { describe, expect, it, vi } from "vitest";+import type Component from "../../components/component";+import FBranch from "../../entities/fbranch";+import type FNote from "../../entities/fnote";import froca from "../../services/froca";-import { buildNotes } from "../../test/easy-froca";-import { getListedChildCount } from "./MobileNoteNavigator";+import type LoadResults from "../../services/load_results";+import { buildNote, buildNotes } from "../../test/easy-froca";+import { renderInto } from "../../test/render";+import { ParentComponent } from "../react/react_utils";+import { getListedChildCount, TitleWithIndicators } from "./MobileNoteNavigator";++vi.mock("../../services/i18n", () => ({+ t: (key: string, options?: object) => (options ? `${key} ${JSON.stringify(options)}` : key),+ translationsInitializedPromise: Promise.resolve()+}));describe("getListedChildCount", () => {buildNotes([@@ -23,3 +35,61 @@ describe("getListedChildCount", () => {expect(getListedChildCount(parent, false)).toBe(3);});});++describe("TitleWithIndicators", () => {+ function addParent(parent: FNote, child: FNote) {+ const branchId = `${parent.noteId}_${child.noteId}`;+ froca.branches[branchId] = new FBranch(froca, {+ branchId, noteId: child.noteId, parentNoteId: parent.noteId, notePosition: 0, fromSearchNote: false+ });+ parent.addChild(child.noteId, branchId, false);+ child.addParent(parent.noteId, branchId, false);+ }++ /** Renders the title under a parent component that collects the reload handlers. */+ function mount(note: FNote) {+ const handlers: ((data: unknown) => void)[] = [];+ const parent = {+ componentId: "cid",+ registerHandler: (name: string, callback: (data: unknown) => void) => {+ if (name === "entitiesReloaded") handlers.push(callback);+ },+ removeHandler: () => {}+ } as unknown as Component;+ let container = document.body;+ act(() => {+ container = renderInto(+ <ParentComponent.Provider value={parent}>+ <TitleWithIndicators note={note} title={note.title} className="title" />+ </ParentComponent.Provider>+ );+ });+ const reloadBranchOf = (noteId: string) => {+ const loadResults = { getBranchRows: () => [ { noteId } ] } as unknown as LoadResults;+ act(() => {+ for (const handler of handlers) handler({ loadResults });+ });+ };+ return { container, reloadBranchOf };+ }++ it("marks a clone and a shared note, and follows a clone made elsewhere", () => {+ buildNote({ title: "First", children: [ { id: "indicated", title: "Indicated" } ] });+ const note = froca.notes["indicated"];+ if (!note) throw new Error("expected the note");++ const { container, reloadBranchOf } = mount(note);+ expect(container.querySelector(".title")?.textContent).toBe("Indicated");+ expect(container.querySelector(".clone-indicator")).toBeNull();+ expect(container.querySelector(".shared-indicator")).toBeNull();++ addParent(buildNote({ title: "Second" }), note);+ addParent(buildNote({ id: "_share", title: "Share" }), note);+ reloadBranchOf(note.noteId);++ const clone = container.querySelector(".clone-indicator");+ expect(clone).not.toBeNull();+ expect(clone?.getAttribute("aria-label")).toContain("Second");+ expect(container.querySelector(".shared-indicator")).not.toBeNull();+ });+});diff --git a/apps/client/src/widgets/mobile_widgets/MobileNoteNavigator.tsx b/apps/client/src/widgets/mobile_widgets/MobileNoteNavigator.tsxindex 6eb8a96342..768a54fd3e 100644--- a/apps/client/src/widgets/mobile_widgets/MobileNoteNavigator.tsx+++ b/apps/client/src/widgets/mobile_widgets/MobileNoteNavigator.tsx@@ -13,8 +13,10 @@ import hoisted_note from "../../services/hoisted_note";import { t } from "../../services/i18n";import note_create from "../../services/note_create";import { onSystemBack, type SystemBackHandler } from "../../services/system_back";+import tree from "../../services/tree";import utils, { isIOS } from "../../services/utils";import { NoteContent } from "../collections/legacy/ListOrGridView";+import { useShareState } from "../layout/NoteBadges";import { Badge } from "../react/Badge";import {useActiveNoteContext,@@ -274,7 +276,7 @@ export default function MobileNoteNavigator() {><div className="mobile-navigator-current-header"><Icon icon={parentIcon ?? "bx bx-folder"} className="mobile-navigator-current-icon" />- <span className="mobile-navigator-current-title">{parentTitle ?? parentNote.title}</span>+ <TitleWithIndicators note={parentNote} title={parentTitle ?? parentNote.title} className="mobile-navigator-current-title" /><buttontype="button"className="mobile-navigator-current-action"@@ -449,7 +451,7 @@ function NavigatorRow({ note, parentNoteId, childNotePath, isActive, isPending,{...contextProps}><Icon icon={icon ?? "bx bx-note"} className="mobile-navigator-row-icon" />- <span className="mobile-navigator-row-title">{title}</span>+ <TitleWithIndicators note={note} title={title} className="mobile-navigator-row-title" />{showHiddenBadge && (<spanclassName="mobile-navigator-row-hidden-badge"@@ -470,6 +472,49 @@ function NavigatorRow({ note, parentNoteId, childNotePath, isActive, isPending,);}+/**+ * A note's title followed by the clone and share icons the desktop tree shows. The title+ * shortens with an ellipsis, so the icons stay visible next to it.+ */+export function TitleWithIndicators({ note, title, className }: { note: FNote, title: string, className: string }) {+ const [ isShared ] = useShareState(note);+ const realParents = useRealParentNotes(note);++ return (+ <span className="mobile-navigator-title-group">+ <span className={className}>{title}</span>+ {realParents.length > 1 && (+ <Icon+ icon="bx bxs-directions"+ className="mobile-navigator-indicator clone-indicator"+ role="img"+ aria-label={tree.getCloneIndicatorTooltip(realParents)}+ />+ )}+ {isShared && (+ <Icon+ icon="bx bx-share-alt"+ className="mobile-navigator-indicator shared-indicator"+ role="img"+ aria-label={t("note_tree.shared-indicator-tooltip")}+ />+ )}+ </span>+ );+}++/** The real parents of `note`, read again when one of its branches changes. */+function useRealParentNotes(note: FNote) {+ const [ realParents, setRealParents ] = useState(() => note.getRealParentNotes());+ useEffect(() => setRealParents(note.getRealParentNotes()), [ note ]);+ useTriliumEvent("entitiesReloaded", ({ loadResults }) => {+ if (loadResults.getBranchRows().some((b) => b.noteId === note.noteId)) {+ setRealParents(note.getRealParentNotes());+ }+ });+ return realParents;+}+/*** Counts the children that `useNavigatorChildren()` lists for `note`. A child that is not in* froca yet counts as listed, since its archived state is unknown until it loads.diff --git a/apps/client/src/widgets/note_tree.ts b/apps/client/src/widgets/note_tree.tsindex cf96f33535..8d51f243ec 100644--- a/apps/client/src/widgets/note_tree.ts+++ b/apps/client/src/widgets/note_tree.ts@@ -796,16 +796,8 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {extraClasses.push("shared");}- if (note.getParentNoteIds().length > 1) {- const realClones = note- .getParentNoteIds()- .map((noteId: string) => froca.notes[noteId])- .filter((note: FNote) => !!note)- .filter((note: FNote) => !["_share", "_lbBookmarks"].includes(note.noteId) && note.type !== "search");-- if (realClones.length > 1) {- extraClasses.push("multiple-parents");- }+ if (note.getRealParentNotes().length > 1) {+ extraClasses.push("multiple-parents");}const cssClass = note.getCssClass();@@ -1876,19 +1868,9 @@ function buildEnhanceTitle() {}// Add clone indicator with tooltip if note has multiple parents- const parentNotes = note.getParentNotes();- const realParents: FNote[] = [];- for (const parent of parentNotes) {- if (parent.noteId !== "_share" && parent.noteId !== "_lbBookmarks" && parent.type !== "search") {- realParents.push(parent);- }- }-+ const realParents = note.getRealParentNotes();if (realParents.length > 1) {- const parentTitles = realParents.map((p) => p.title).join(", ");- const tooltipText = realParents.length === 2- ? t("note_tree.clone-indicator-tooltip-single", { parent: realParents[1].title })- : t("note_tree.clone-indicator-tooltip", { count: realParents.length, parents: parentTitles });+ const tooltipText = treeService.getCloneIndicatorTooltip(realParents);const $cloneIndicator = $(`<span class="note-indicator-icon clone-indicator"></span>`);$cloneIndicator.attr("title", tooltipText);diff --git a/apps/server/src/assets/help/help_content.json b/apps/server/src/assets/help/help_content.jsonindex b309140e70..8d5ace1fdc 100644--- a/apps/server/src/assets/help/help_content.json+++ b/apps/server/src/assets/help/help_content.json@@ -65,7 +65,7 @@"_help_l7pigIGu01K2": "<p>Alongside its content, the <strong>title</strong> is one of the two main attributes of a <a href=\"#root/_help_BFs8mudNFgCS\">note</a>. It's the short, human-readable name shown in the editable field at the top of every note, and it's what identifies the note throughout the interface (in the <a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a>, in tabs, in the <a class=\"reference-link\" href=\"#root/_help_I6p2a06hdnL6\">Breadcrumb</a> and win <a class=\"reference-link\" href=\"#root/_help_hrZ1D00cLbal\">Internal (reference) links</a>.</p><p>Internally, notes are identified by a unique <a class=\"reference-link\" href=\"#root/_help_m1lbrzyKDaRB\">Note ID</a> rather than by their title, so the title is purely for your benefit. This has a few consequences:</p><ul><li><strong>Titles don't have to be unique.</strong> You can have any number of notes that share the same title without conflict.</li><li><strong>Renaming a note never breaks links to it.</strong> Links between notes point at the underlying note, so changing a title leaves existing links intact (they'll simply display the new title).</li><li><strong>The title can be left empty.</strong> Notes with no title display a placeholder (<em>type note's title here…</em>) but are otherwise perfectly valid.</li></ul><p>In addition:</p><ul><li>There is no limitation on the length of the title, however in exports the title might get trimmed.</li><li>There are no forbidden symbols, unsupported characters will get trimmed when exporting.</li><li>When exporting to a ZIP file, a meta file will contain the full title which will be recognized by Trilium when importing again.</li></ul><h2>Inline title</h2><p><a class=\"reference-link\" href=\"#root/_help_iPIMuisry3hd\">Text</a> notes have a special title bar behavior in which the <a href=\"#root/_help_l7pigIGu01K2\">note title</a> is initially displayed in a larger font, while also displaying additional information such as the creation and the modification date.</p><p>Whenever the title is scrolled past, the fixed title is shown instead.</p><p>Note types that take the entirety of the screen, such as <a class=\"reference-link\" href=\"#root/_help_6f9hih2hXXZk\">Code</a> and <a class=\"reference-link\" href=\"#root/_help_grjYqerjn243\">Canvas</a>, will always have only the fixed title bar.</p><p>Under the note title, the <a class=\"reference-link\" href=\"#root/_help_m3VlURMSeOrd\">New note type switcher</a> appears if the note is empty.</p><figure class=\"image\"><img style=\"aspect-ratio:899/122;\" src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/Notes/Title_image.png\" width=\"899\" height=\"122\"><figcaption>The <em>Inline title</em>, which is displayed at the top of the note and can be scrolled past.</figcaption></figure><figure class=\"image\"><img style=\"aspect-ratio:910/104;\" src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/Notes/1_Title_image.png\" width=\"910\" height=\"104\"><figcaption>The fixed title bar. The title only appears after scrolling past the <em>Inline title</em>.</figcaption></figure><h3>Editing the title</h3><p>To rename a note, simply click into the title field and type. Changes are saved automatically as you type.</p><p>You can also begin editing the title directly from the <a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a> by selecting a note and pressing <kbd>Enter</kbd> (see <em>Edit note title</em> in <a class=\"reference-link\" href=\"#root/_help_A9Oc6YKKc65v\">Keyboard Shortcuts</a>), which focuses the title field for the active note.</p><aside class=\"admonition note\"><p>Titles may contain any characters, including Unicode and emoji. For security, any HTML in the title is stripped automatically, so the title is always treated as plain text.</p></aside><h3>Easily navigating between the title and the content</h3><p>When the cursor is in the title field, pressing <kbd>Enter</kbd> moves focus into the note's content. For <a class=\"reference-link\" href=\"#root/_help_iPIMuisry3hd\">Text</a> notes this also inserts a fresh empty paragraph at the very top of the document, so you can start writing immediately — much like other note-taking apps.</p><p>This makes it possible to create a note, type its title, press <kbd>Enter</kbd>, and continue straight into the body without reaching for the mouse.</p><h3>Working with new notes</h3><p>When you create a new note it's given a default title (<em>new note</em>) which is pre-selected, so you can type a name right away to replace it. The default title for new notes can be customized per-section — see <a class=\"reference-link\" href=\"#root/_help_47ZrP6FNuoG8\">Default Note Title</a>.</p><p>If you decide you don't want the note after all, pressing <kbd>Escape</kbd> while the title of a freshly created note is still focused will discard it.</p><h3>Automatically generated titles</h3><p>Some notes get their titles assigned automatically rather than typed:</p><ul><li><strong>Day, week, month and year notes</strong> in the <a class=\"reference-link\" href=\"#root/_help_l0tKav7yLHGF\">Day Notes</a> are named from a configurable date pattern.</li><li><a class=\"reference-link\" href=\"#root/_help_m523cpzocqaD\">Saved Search</a> notes are named after the search they perform.</li><li>When a note is duplicated, a suffix is appended to the copy's title to tell it apart from the original.</li></ul><h3>Protected notes</h3><p>The titles of <a class=\"reference-link\" href=\"#root/_help_bwg0e8ewQMak\">Protected Notes</a> are encrypted along with their content. Before entering your password, Trilium cannot decrypt the title: the note tree, the title field, the breadcrumb menus and the tabs label the note <em>Protected</em>, and the title cannot be modified.</p><p>Once you enter your password and a protected session is active, the real title is decrypted and displayed, and becomes editable again.</p>","_help_p9kXRFAkwN4o": "<h2>Icons</h2><figure class=\"image image-style-align-right image_resized\" style=\"width:48.4%;\"><img style=\"aspect-ratio:1089/995;\" src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/Notes/Note%20Icons%20%26%20Colors_image.png\" width=\"1089\" height=\"995\"></figure><p>Icons are useful for distinguishing notes and are displayed near the note title, as well as in various places such as the <a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a>, <a class=\"reference-link\" href=\"#root/_help_hrZ1D00cLbal\">Internal (reference) links</a> or the <a class=\"reference-link\" href=\"#root/_help_F1r9QtzQLZqm\">Jump to & command palette</a>.</p><p>While editing a note, click on the icon next to the title to bring up a chooser gallery.</p><p>Icons can be inherited through the use of <a class=\"reference-link\" href=\"#root/_help_KC1HB96bqqHX\">Templates</a>, or <a class=\"reference-link\" href=\"#root/_help_bwZpz2ajCEwO\">Attribute Inheritance</a>.</p><aside class=\"admonition note\"><p>At the technical level, they are set by the <code>iconClass</code> attribute which adds a CSS class to the note. For example <code>#iconClass=\"bx bx-calendar\"</code> will show a calendar instead of the default page or folder icon. Looking up and remembering the CSS class names is not necessary.</p></aside><h2>Colors</h2><p>Notes can also carry a custom color. Similar to the note icon, this color will be shown in various places such as the <a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a> and <a class=\"reference-link\" href=\"#root/_help_hrZ1D00cLbal\">Internal (reference) links</a>.</p><p>To set a custom color, right click on the note in the <a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a> and select a predefined color from there or use the color picker (last option).</p><p>Alternatively, a custom color can be set manually through the <code>#color</code> <a href=\"#root/_help_HI6GBBIduIgv\">label</a>, whose value must be a valid hex color including the leading <code>#</code> (e.g. <code>#ff0000</code> for red). This color can be carried over across multiple notes via <a class=\"reference-link\" href=\"#root/_help_bwZpz2ajCEwO\">Attribute Inheritance</a>.</p>","_help_0vhv7lsOLy82": "<p>A <a href=\"#root/_help_BFs8mudNFgCS\">note</a> in Trilium can <em>own</em> one or more attachments, which can be either images or files. These attachments can be displayed or linked within the note that owns them.</p><p>This can be especially useful to include dependencies for your <a href=\"#root/_help_CdNpE2pqjmI6\">scripts</a>. The <a class=\"reference-link\" href=\"#root/_help_R7abl2fc6Mxi\">Weight Tracker</a> shows how to use <a href=\"https://chartjs.org/\">chartjs</a> which is attached to the script note.</p><p>Each note exclusively owns its attachments, meaning attachments cannot be shared or linked from one note to another. If an attachment link is copied to a different note, the attachment itself is duplicated, and the copies are managed independently thereafter.</p><p>Attachments, especially image files, are the recommended method for embedding visuals in notes. It is important to link image attachments within the text of the owning note; otherwise, they will be automatically deleted after a configurable timeout period if not referenced.</p><h2>Types of attachments</h2><p>There are two different types of attachment:</p><ul><li><em>User content</em>, representing files or images that are uploaded and part of the content of the note.</li><li><em>System attachments</em> which are used internally by Trilium and can be of multiple types, including:<ul><li><a class=\"reference-link\" href=\"#root/_help_GTwFsgaA0lCt\">Collections</a> to store information about views such as the column information for the <a class=\"reference-link\" href=\"#root/_help_CtBQqbwXDx1w\">Kanban Board</a>.</li><li>Icons and cover images for <a class=\"reference-link\" href=\"#root/_help_UmgZAfcltxkS\">Link Previews</a>.</li><li>Debug information for some importers such as <a class=\"reference-link\" href=\"#root/_help_GnhlmrATVqcH\">Microsoft OneNote</a> (only if the debug flag was enabled at import time).</li><li>The transcript of a <a class=\"reference-link\" href=\"#root/_help_Y84QCbArmK3z\">Meeting transcription</a>, which is also shown above the note's content.</li></ul></li></ul><p>The system attachments are displayed at the end of the attachments list, in a dedicated section (<em>Generated by Trilium</em>).</p><h2>Uploading attachments</h2><p>The <span class=\"tn-icon bx bx-paperclip\"></span><em>Attachments</em> item of the <a class=\"reference-link\" href=\"#root/_help_8YBEPzcpUgxw\">Note menu</a> opens the list of the note's attachments.</p><ul><li>To upload files as attachments, press <em>Upload attachments</em> at the top of the list and select one or more files.</li><li>Alternatively, drag one or more files from the file explorer and drop them anywhere on the list. Pictures are compressed if <em>Automatic image compression</em> is enabled in <a class=\"reference-link\" href=\"#root/_help_4TIF1oA4VQRO\">Options</a> → <em>Media</em>.</li></ul><h2>Attaching files from a text note</h2><p>To attach files to a <a class=\"reference-link\" href=\"#root/_help_iPIMuisry3hd\">Text</a> note and embed them in its content, press the <span class=\"tn-icon cke cke-paper-clip\"></span><em>Attach file</em> button in the <a class=\"reference-link\" href=\"#root/_help_nRhnJkTT8cPs\">Formatting toolbar</a>, choose <em>Attach and embed file</em> and select one or more files (see <em>Embedding an attachment</em> below). The same menu offers <em>Image</em>, which inserts pictures (see <a class=\"reference-link\" href=\"#root/_help_mT0HEkOsz6i1\">Images</a>), and <em>Attach file as a link</em>, which links the files instead. Both file actions are also available as <em>Attach file as a link</em> and <em>Attach and embed file</em> in the <a class=\"reference-link\" href=\"#root/_help_ZlN4nump6EbW\">Slash Commands</a>. On a phone, the menu also offers <em>Camera</em> (see <a class=\"reference-link\" href=\"#root/_help_RDslemsQ6gCp\">Mobile Frontend</a>).</p><p>When files are attached as links:</p><ul><li>Each file becomes an attachment of the note, and a link to it is inserted at the cursor. Several files produce several links, separated by a space.</li><li>While a file uploads, its link shows the file name and a toast shows the progress.</li><li>Pictures appear as links rather than images, and are attached exactly as they are, without being compressed. To display a picture in the text, use <em>Image</em> in the same menu instead (see <a class=\"reference-link\" href=\"#root/_help_mT0HEkOsz6i1\">Images</a>).</li></ul><p>Dragging a file that is not a picture from the file explorer onto the text also attaches it and inserts a link to it.</p><h2>Acting on an attachment link</h2><p>Right-clicking a link to an attachment shows the ways to open it, followed by actions on the attachment: opening it externally, downloading it, uploading a new revision, renaming or deleting it, and converting it into a note.</p><p>Links follow changes to their attachment: renaming it updates the title they show, and deleting it removes them from the text notes open for editing at that moment. Converting it into a note turns its links into links to the new note.</p><h2>Embedding an attachment</h2><p>An attachment can be shown in the text instead of linked, the way <a class=\"reference-link\" href=\"#root/_help_nBAXQFj20hS1\">Include Note</a> shows a note: a picture is displayed, a PDF, a video or a document is previewed, a code or text file is shown with syntax highlighting, and a Markdown file such as a <code>.md</code> file is shown rendered. An embedded code file can also be edited in place (see <em>Editing an include in place</em> in <a class=\"reference-link\" href=\"#root/_help_nBAXQFj20hS1\">Include Note</a>), and an embedded Markdown file shows its source, its rendering or both, as an included Markdown note does (see <em>Included Markdown</em> there).</p><ul><li>To attach files and embed them straight away, press the <span class=\"tn-icon cke cke-paper-clip\"></span><em>Attach file</em> button and choose <em>Attach and embed file</em>. Each file gets an embed of its own, which shows the file name while the file uploads.</li><li>To embed an attachment that is already linked, right-click a link to it in a text note being edited and select <em>Convert link to an embed</em>, at the end of the menu.</li><li>A drawing canvas, inserted with <span class=\"tn-icon bx bx-pen\"></span><em>Drawing canvas</em> in the <span class=\"tn-icon cke cke-plus\"></span><em>Insert</em> menu, is an embed of a <code>Canvas.excalidraw</code> attachment that can be drawn on in place. An attached Excalidraw file (<code>.excalidraw</code>) is embedded as a drawing canvas too (see <em>Drawing canvases</em> in <a class=\"reference-link\" href=\"#root/_help_nBAXQFj20hS1\">Include Note</a>).</li><li>An embed gets the box size that suits the attachment, as a new included note does (see <em>Box sizes</em> there). To change its size, select the embed and use the box size menu in its toolbar, or the <em>Size</em> submenu of its <span class=\"tn-icon bx bx-dots-vertical-rounded\"></span><em>More actions</em> menu. A <em>Small</em>, <em>Medium</em> or <em>Expandable</em> embed can also be resized by dragging its handles (see <em>Resizing</em> there).</li><li>An embed can have a caption, as an included note can (see <em>Caption</em> there).</li><li>To show only the attachment, select the embed and press the <span class=\"tn-icon bx bx-window-alt\"></span> (<em>Show title)</em> button in its toolbar, as for an included note (see <em>Title</em> there).</li><li>To open the attachment in a new tab, press the <span class=\"tn-icon bx bx-link-external\"></span> (<em>Open in new tab)</em> button at the end of the embed's title.</li><li>An embed of size <em>Tiny</em> shows only the title of the attachment and its size, in a single row. Its buttons are <span class=\"tn-icon bx bx-file-find\"></span><em>Open externally</em> and <span class=\"tn-icon bx bx-download\"></span><em>Download</em>.</li><li>To show an embed of size <em>Medium</em> or <em>Full</em> on the whole screen, press the <span class=\"tn-icon bx bx-fullscreen\"></span> (<em>Fullscreen)</em> button at the end of its title. To return, press <span class=\"tn-icon bx bx-exit\"></span> (<em>Exit fullscreen)</em> in the top-right corner, or <kbd>Esc</kbd>.</li><li>To turn the embed back into a link, select it and press the <span class=\"tn-icon cke cke-link\"></span><em>Convert to link</em> button in its toolbar. <em>Convert to link</em> also ends the menu that right-clicking the title row of the embed or pressing its <span class=\"tn-icon bx bx-dots-vertical-rounded\"></span><em>More actions</em> button opens.</li></ul><p>An embed follows its attachment like a link does. Converting the attachment into a note turns the embed into an included note. In a <a href=\"#root/_help_R9pX4DGra2Vt\">shared note</a>, an embedded picture is displayed with its caption, a drawing canvas as a picture of the drawing, and any other attachment, or a picture in a <em>Tiny</em> embed, appears as a link to download it.</p><h2>Converting notes to attachments</h2><p><a class=\"reference-link\" href=\"#root/_help_W8vYD3Q1zjCR\">File</a> notes can be easily converted to attachments of the parent note.</p><p>To do so:</p><ul><li>For a single note, press the context menu from the <a class=\"reference-link\" href=\"#root/_help_8YBEPzcpUgxw\">Note menu</a> and select <em>Convert into attachment</em>.</li><li>For multiple notes, select the given notes in the <a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a>, right click → Advanced → <em>Convert to attachment…</em>.</li></ul><h2>Attachment previews</h2><p>Attachments share the same content preview for images, videos, PDFs, etc. as the <a class=\"reference-link\" href=\"#root/_help_W8vYD3Q1zjCR\">File</a> note type. A Markdown attachment is previewed rendered, as a <a class=\"reference-link\" href=\"#root/_help_6RM1Q7ppFVoj\">Markdown</a> note is.</p>",- "_help_IakOLONlIfGI": "<h2>Motivation</h2><p>Trilium's core feature is the ability to structure your notes into hierarchical tree-like structure.</p><p>It is expected then that you'll have an elaborate and deep note hierarchy - each subtree will represent a more refined and specialized view of your knowledge base.</p><p>This is a pretty powerful approach, but it also carries a hidden assumption that each \"subtopic\" is \"owned\" by one parent. I'll illustrate this with an example - let's say my basic structure is this:</p><ul><li>Technology<ul><li>Programming<ul><li>Kotlin</li><li>JavaScript</li></ul></li><li>Operating systems<ul><li>Linux</li><li>Windows</li></ul></li></ul></li></ul><p>Now, I'm starting to learn about <a href=\"https://en.wikipedia.org/wiki/Bash_(Unix_shell)\">Bash</a> and would like to create notes related to this topic. But now I'm facing a problem of where to categorize this. The issue here is that Bash is both a programming language and a tool (shell) very much tied into Linux. It seems it belongs to both of these, I can't (and don't want to) choose one over the other.</p><h2>Solution</h2><p>The solution to the problem shown above is to allow notes to have multiple parents.</p><p>I call these \"clones\", but that is a bit misleading - there's no original and cloned note - the notes in both of the parents categories are identical.</p><p>Another misleading thing about \"cloning\" is that it suggests that a copy of the note has been made. That's not really true, the note itself stays in just one original, it is just referenced in multiple places in the tree hierarchy. So changing it in one category changes it in all the others, because they're all the same note.</p><p>Here's the final structure with cloning:</p><ul><li>Technology<ul><li>Programming<ul><li>Kotlin</li><li>JavaScript</li><li>Bash<ul><li>some sub-notes ...</li></ul></li></ul></li><li>Operating systems<ul><li>Linux<ul><li>Bash<ul><li>some sub-notes ...</li></ul></li></ul></li><li>Windows</li></ul></li></ul></li></ul><p>So now the \"Bash\" subtree appears on multiple locations in the hierarchy. Both the Bash subtrees are the same and contain the same sub-categories and notes.</p><h3>Demo</h3><p><img src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/Notes/Cloning%20Notes_create-clone.gif\"></p><p>In the demo, you can see how a clone can be created using the context menu. It's possible to do this also using the Add Link dialog or with <kbd>Ctrl</kbd>+<kbd>C</kbd> and <kbd>Ctrl</kbd>+<kbd>V</kbd> <a href=\"#root/_help_A9Oc6YKKc65v\">keyboard shortcuts</a>.</p><p>You can view the list of all available clones:</p><ul><li>In the <a class=\"reference-link\" href=\"#root/_help_AlJ73vBCjWDw\">Status bar</a>, by looking for the <span class=\"tn-icon bx bx-directions\"></span> icon.</li><li>In the <a class=\"reference-link\" href=\"#root/_help_KRlZFoIH0j6p\">Connections tab</a> of the <a class=\"reference-link\" href=\"#root/_help_RnaPdbciOfeq\">Right Sidebar</a>, by looking at the <em>Note paths</em> section.</li></ul><p>Titles of cloned notes in the tree view have an asterisk to the right to easily see that the note is also placed into some other location.</p><h2>Deleting notes/clones</h2><p>With clones, it might not be immediately obvious how deleting works.</p><p>If you try to delete a note, it works like this:</p><ol><li>if the note has multiple clones, delete just this clone and leave the actual note (and its other clones) as it is.</li><li>if this note doesn't have any other clones, delete the note<ul><li>Run the whole process starting with 1. on all note's children notes</li></ul></li></ol>",+ "_help_IakOLONlIfGI": "<h2>Motivation</h2><p>Trilium's core feature is the ability to structure your notes into hierarchical tree-like structure.</p><p>It is expected then that you'll have an elaborate and deep note hierarchy - each subtree will represent a more refined and specialized view of your knowledge base.</p><p>This is a pretty powerful approach, but it also carries a hidden assumption that each \"subtopic\" is \"owned\" by one parent. I'll illustrate this with an example - let's say my basic structure is this:</p><ul><li>Technology<ul><li>Programming<ul><li>Kotlin</li><li>JavaScript</li></ul></li><li>Operating systems<ul><li>Linux</li><li>Windows</li></ul></li></ul></li></ul><p>Now, I'm starting to learn about <a href=\"https://en.wikipedia.org/wiki/Bash_(Unix_shell)\">Bash</a> and would like to create notes related to this topic. But now I'm facing a problem of where to categorize this. The issue here is that Bash is both a programming language and a tool (shell) very much tied into Linux. It seems it belongs to both of these, I can't (and don't want to) choose one over the other.</p><h2>Solution</h2><p>The solution to the problem shown above is to allow notes to have multiple parents.</p><p>I call these \"clones\", but that is a bit misleading - there's no original and cloned note - the notes in both of the parents categories are identical.</p><p>Another misleading thing about \"cloning\" is that it suggests that a copy of the note has been made. That's not really true, the note itself stays in just one original, it is just referenced in multiple places in the tree hierarchy. So changing it in one category changes it in all the others, because they're all the same note.</p><p>Here's the final structure with cloning:</p><ul><li>Technology<ul><li>Programming<ul><li>Kotlin</li><li>JavaScript</li><li>Bash<ul><li>some sub-notes ...</li></ul></li></ul></li><li>Operating systems<ul><li>Linux<ul><li>Bash<ul><li>some sub-notes ...</li></ul></li></ul></li><li>Windows</li></ul></li></ul></li></ul><p>So now the \"Bash\" subtree appears on multiple locations in the hierarchy. Both the Bash subtrees are the same and contain the same sub-categories and notes.</p><h3>Demo</h3><p><img src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/Notes/Cloning%20Notes_create-clone.gif\"></p><p>In the demo, you can see how a clone can be created using the context menu. It's possible to do this also using the Add Link dialog or with <kbd>Ctrl</kbd>+<kbd>C</kbd> and <kbd>Ctrl</kbd>+<kbd>V</kbd> <a href=\"#root/_help_A9Oc6YKKc65v\">keyboard shortcuts</a>.</p><p>You can view the list of all available clones:</p><ul><li>In the <a class=\"reference-link\" href=\"#root/_help_AlJ73vBCjWDw\">Status bar</a>, by looking for the <span class=\"tn-icon bx bx-directions\"></span> icon.</li><li>In the <a class=\"reference-link\" href=\"#root/_help_KRlZFoIH0j6p\">Connections tab</a> of the <a class=\"reference-link\" href=\"#root/_help_RnaPdbciOfeq\">Right Sidebar</a>, by looking at the <em>Note paths</em> section.</li></ul><p>In the <a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a>, on desktop and on mobile, the title of a cloned note is followed by a <span class=\"tn-icon bx bxs-directions\"></span> icon, to easily see that the note is also placed into some other location. A shared note is followed by a <span class=\"tn-icon bx bx-share-alt\"></span> icon in the same way.</p><h2>Deleting notes/clones</h2><p>With clones, it might not be immediately obvious how deleting works.</p><p>If you try to delete a note, it works like this:</p><ol><li>if the note has multiple clones, delete just this clone and leave the actual note (and its other clones) as it is.</li><li>if this note doesn't have any other clones, delete the note<ul><li>Run the whole process starting with 1. on all note's children notes</li></ul></li></ol>","_help_TBwsyfadTA18": "<p>Since a single note can appear into multiple places in the <a class=\"reference-link\" href=\"#root/_help_oPVyFC7WL2Lp\">Note Tree</a> via a process called <a class=\"reference-link\" href=\"#root/_help_IakOLONlIfGI\">Cloning Notes</a>, it's recommended to choose a generalized name that fits into all locations instead of something more specific to avoid confusion.</p><p>In some cases this isn't possible so Trilium provides \"branch prefixes\", which is shown before the note name in the tree and as such provides a specific kind of context.</p><p>The prefix is location-specific, so it's displayed only in the note tree.</p>","_help_bwg0e8ewQMak": "<p>Trilium is designed to store a wide variety of data, including sensitive information such as personal journals, credentials, or confidential documents. To safeguard this type of content, Trilium offers the option to protect notes, which involves the following measures:</p><ul><li><strong>Encryption:</strong> Protected notes are encrypted using a key derived from your password. This ensures that without the correct password, protected notes remain indecipherable. Even if someone gains access to your Trilium <a href=\"#root/_help_wX4HbRucYSDD\">database</a>, they won't be able to read your encrypted notes.</li><li><strong>Time-limited access:</strong> To access protected notes, you must first enter your password, which decrypts the note for reading and writing. However, after a specified period of inactivity (10 minutes by default), the note is unloaded from memory, requiring you to re-enter your password to access it again.<ul><li>The session timeout is extended automatically while you're interacting with the protected note, so if you're actively editing, the session remains open. However, if you switch to an unprotected note, the session timer starts, and the session expires after 10 minutes of inactivity unless you return to the protected notes.</li></ul></li><li><strong>Protection scope:</strong> Protected notes ensure the confidentiality of their content and partially their integrity. While unauthorized users cannot read or edit protected notes, they can still delete or move them outside of the protected session.</li></ul><h2>Using Protected Notes</h2><p>By default, notes are unprotected. To protect a note, simply click on the shield icon next to the note's title, as shown here:</p><p><img src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/Notes/Protected%20Notes_protecting-note.gif\" alt=\"example animation of unlocking protected notes\"></p><h2>What is Encrypted?</h2><p>Trilium encrypts the data within protected notes but not their metadata. Specifically:</p><p><strong>Encrypted:</strong></p><ul><li>Note title</li><li>Note content</li><li>Images</li><li>File attachments</li></ul><p><strong>Not encrypted:</strong></p><ul><li>Note structure (i.e., it remains visible that there are protected notes)</li><li>Metadata, such as the last modified date</li><li><a href=\"#root/_help_zEY4DaJG4YT5\">Attributes</a></li></ul><h2>Encryption Details</h2><p>The following steps outline how encryption and decryption work in Trilium:</p><ol><li>The user enters a password.</li><li>The password is passed through the <a href=\"https://en.wikipedia.org/wiki/Scrypt\">scrypt</a> algorithm along with a \"password verification\" <a href=\"https://en.wikipedia.org/wiki/Salt_(cryptography)\">salt</a> to confirm that the password is correct.</li><li>The password is then processed again through scrypt with an \"encryption\" salt, which generates a hash.<ul><li>Scrypt is used for <a href=\"https://en.wikipedia.org/wiki/Key_stretching\">key stretching</a> to make the password harder to guess.</li></ul></li><li>The generated hash is used to decrypt the actual <em>data encryption key</em>.<ul><li>The data encryption key is encrypted using <a href=\"https://en.wikipedia.org/wiki/Advanced_Encryption_Standard\">AES-128</a> with a random <a href=\"https://en.wikipedia.org/wiki/Initialization_vector\">IV</a>.</li><li>The data encryption key is randomly generated during the <a href=\"#root/_help_wX4HbRucYSDD\">database</a> initialization and remains constant throughout the document’s lifetime. When the password is changed, only this key is re-encrypted.</li></ul></li><li>The data encryption key is then used to decrypt the actual content of the note, including its title and body.<ul><li>The encryption algorithm used is AES-128 with <a href=\"https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation\">CBC mode</a>, where a unique IV is generated for each encryption operation and stored with the cipher text.</li></ul></li></ol><h2>Sharing Protected Notes</h2><p>Protected notes cannot be shared in the same way as regular notes. Their encryption ensures that only authorized users with the correct password can access them.</p>","_help_MKmLg5x6xkor": "<p>Archived notes are notes which have <code>archived</code> <a href=\"#root/_help_zEY4DaJG4YT5\">attribute</a> - either directly or <a href=\"#root/_help_bwZpz2ajCEwO\">inherited</a>.</p><p>Such notes are then by default not shown in the autocomplete and in the full text <a href=\"#root/_help_eIg8jdvaoNNd\">search</a>.</p><p>This can be useful for notes which are no longer very useful but still valuable enough to keep around without them getting too much in the way.</p><p>You can control whether archived notes are displayed in the note tree with a setting:</p><p><img src=\"{{helpAssets}}/User%20Guide/Basic%20Concepts%20and%20Features/Notes/Archived%20Notes_hide-archived.png\"></p>",diff --git a/docs/User Guide/User Guide/Basic Concepts and Features/Notes/Cloning Notes.md b/docs/User Guide/User Guide/Basic Concepts and Features/Notes/Cloning Notes.mdindex da93aad035..176f00bf8d 100644--- a/docs/User Guide/User Guide/Basic Concepts and Features/Notes/Cloning Notes.md+++ b/docs/User Guide/User Guide/Basic Concepts and Features/Notes/Cloning Notes.md@@ -52,7 +52,7 @@ You can view the list of all available clones:* In the <a class="reference-link" href="../UI%20Elements/Status%20bar.md">Status bar</a>, by looking for the <span class="tn-icon bx bx-directions"></span> icon.* In the <a class="reference-link" href="../UI%20Elements/Right%20Sidebar/Connections%20tab.md">Connections tab</a> of the <a class="reference-link" href="../UI%20Elements/Right%20Sidebar.md">Right Sidebar</a>, by looking at the _Note paths_ section.-Titles of cloned notes in the tree view have an asterisk to the right to easily see that the note is also placed into some other location.+In the <a class="reference-link" href="../UI%20Elements/Note%20Tree.md">Note Tree</a>, on desktop and on mobile, the title of a cloned note is followed by a <span class="tn-icon bx bxs-directions"></span> icon, to easily see that the note is also placed into some other location. A shared note is followed by a <span class="tn-icon bx bx-share-alt"></span> icon in the same way.## Deleting notes/clones