Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
client/text editor/include notes: use the image viewer for image attachments
Adorian Doran4db1b1579147
diff --git a/apps/client/src/menus/image_context_menu.ts b/apps/client/src/menus/image_context_menu.tsindex 298f7364db..d24270cd02 100644--- a/apps/client/src/menus/image_context_menu.ts+++ b/apps/client/src/menus/image_context_menu.ts@@ -5,6 +5,7 @@ import imageService from "../services/image.js";const PROP_NAME = "imageContextMenuInstalled";+/** Adds the Electron image menu to `$image`: an `<img>`, or the container of an image viewer. */function setupContextMenu($image: JQuery<HTMLElement>) {if (!utils.isElectron() || $image.prop(PROP_NAME)) {return;@@ -30,10 +31,13 @@ function setupContextMenu($image: JQuery<HTMLElement>) {}],selectMenuItemHandler: async ({ command }) => {+ // An image viewer passes its container: its <img> takes no pointer events.+ const isContainer = !$image.is("img");+ const $img = isContainer ? $image.find("img").first() : $image;if (command === "copyImageReferenceToClipboard") {- imageService.copyImageReferenceToClipboard($image);+ imageService.copyImageReferenceToClipboard(isContainer ? $img.parent() : $img);} else if (command === "copyImageToClipboard") {- const src = $image.attr("src");+ const src = $img.attr("src");if (!src) {console.error("Missing src");return;diff --git a/apps/client/src/services/content_renderer.css b/apps/client/src/services/content_renderer.cssindex 63bca1e3f5..b6a13dedfa 100644--- a/apps/client/src/services/content_renderer.css+++ b/apps/client/src/services/content_renderer.css@@ -37,6 +37,16 @@height: 100%;}+/* Fills a host of fixed height, such as a fullscreen embed; elsewhere the image sets the height. */+.rendered-content .rendered-image-viewer {+ height: 100%;++ /* A failed image has no size, so the error message needs a floor. */+ .image-viewer-root:has(.img-loading-error) {+ min-height: 8rem;+ }+}+/* The mounted media player (placeholder or full) takes the space its host gives it, above the file footer,down to a floor that keeps it usable in a short host such as a collection tile. */.rendered-content .rendered-media {diff --git a/apps/client/src/services/content_renderer.spec.ts b/apps/client/src/services/content_renderer.spec.tsindex 0e462b30a6..5818326cd0 100644--- a/apps/client/src/services/content_renderer.spec.ts+++ b/apps/client/src/services/content_renderer.spec.ts@@ -87,6 +87,10 @@ vi.mock("../widgets/type_widgets/WebView", () => ({ default: webViewComponent })const mediaPreviewComponent = vi.fn((_props: any): VNode<any> => h("span", { class: "mock-media-marker" }));vi.mock("../widgets/type_widgets/file/MediaPreview", () => ({ default: mediaPreviewComponent }));+const imageViewerComponent = vi.fn((_props: any): VNode<any> =>+ h("span", { class: "mock-image-viewer-marker" }));+vi.mock("../widgets/react/ImageViewer", () => ({ default: imageViewerComponent }));+const embeddedNoteListComponent = vi.fn((_props: any) => null);vi.mock("../widgets/collections/NoteList", () => ({ EmbeddedNoteList: embeddedNoteListComponent }));@@ -309,6 +313,42 @@ describe("getRenderedContent image rendering", () => {expect($renderedContent.find("img").attr("src")).toContain(`api/attachments/${att.attachmentId}/image/`);});+ it("mounts the image viewer when the caller embeds an image note or attachment", async () => {+ const note = buildNote({ title: "Pic", type: "image" });+ const { type, $renderedContent } = await getRenderedContent(note, {+ mediaEnvironment: "embedded"+ });+ expect(type).toBe("image");+ const $viewer = $renderedContent.find(".rendered-image-viewer");+ expect($viewer.find(".mock-image-viewer-marker").length).toBe(1);+ expect($renderedContent.find("img").length).toBe(0);+ expect(imageViewerComponent).toHaveBeenCalledWith(expect.objectContaining({+ src: expect.stringContaining(`api/images/${note.noteId}/`),+ alt: "Pic",+ environment: "embedded"+ }), expect.anything());+ // The viewer's <img> takes no pointer events, so the menu listens on the container.+ expect(setupContextMenu).toHaveBeenCalledOnce();+ expect(setupContextMenu.mock.calls[0][0].get(0)).toBe($viewer.get(0));++ const att = buildAttachment({ role: "image" });+ await getRenderedContent(att, { mediaEnvironment: "embedded" });+ expect(imageViewerComponent).toHaveBeenLastCalledWith(expect.objectContaining({+ src: expect.stringContaining(`api/attachments/${att.attachmentId}/image/`)+ }), expect.anything());+ });++ it("keeps a plain image for an embedded canvas and outside an embed", async () => {+ const canvas = buildNote({ title: "C", type: "canvas" });+ const embedded = await getRenderedContent(canvas, { mediaEnvironment: "embedded" });+ expect(embedded.$renderedContent.find("img").length).toBe(1);++ const note = buildNote({ title: "Pic", type: "image" });+ const native = await getRenderedContent(note, { mediaEnvironment: "native" });+ expect(native.$renderedContent.find("img").length).toBe(1);+ expect(imageViewerComponent).not.toHaveBeenCalled();+ });+it("appends OCR text for FNote images when showTextRepresentation and OCR succeeds", async () => {const note = buildNote({ title: "OcrPic", type: "spreadsheet" });server.get = vi.fn(async () => ({ success: true, hasOcr: true, text: "hello-ocr" })) as typeof server.get;diff --git a/apps/client/src/services/content_renderer.ts b/apps/client/src/services/content_renderer.tsindex 83007ccc30..38db6d47e9 100644--- a/apps/client/src/services/content_renderer.ts+++ b/apps/client/src/services/content_renderer.ts@@ -71,6 +71,8 @@ export interface RenderOptions {* the player, for the callers that serialize the rendered content into an HTML string or into a separate* document (presentation, printing) — a mounted player would be dead markup there.*+ * For images, `embedded` mounts the zoom/pan image viewer and the others a plain `<img>`.+ ** A full-size player has no entry here: it needs the tab it lives in (for sibling navigation and the OS* media session), which the renderer has no access to, so its hosts mount {@link MediaPreview} themselves.*/@@ -122,6 +124,8 @@ export async function getRenderedContent(this: {} | { ctx: string }, entity: FNoawait renderCode(entity, $renderedContent);} else if (type === "iconPack" && !options.tooltip && entity instanceof FNote) {await renderIconPack(entity, $renderedContent, options);+ } else if (type === "image" && options.mediaEnvironment === "embedded") {+ await renderImageViewer(entity, $renderedContent);} else if (["image", "canvas", "mindMap", "spreadsheet"].includes(type)) {await renderImage(entity, $renderedContent, options);} else if (!options.tooltip && type === "office") {@@ -268,16 +272,6 @@ async function renderCode(note: FNote | FAttachment, $renderedContent: JQuery<HT}async function renderImage(entity: FNote | FAttachment, $renderedContent: JQuery<HTMLElement>, options: RenderOptions = {}) {- const encodedTitle = encodeURIComponent(entity.title);-- let url;-- if (entity instanceof FNote) {- url = `api/images/${entity.noteId}/${encodedTitle}?${Math.random()}`;- } else if (entity instanceof FAttachment) {- url = `api/attachments/${entity.attachmentId}/image/${encodedTitle}?${entity.utcDateModified}`;- }-$renderedContent // styles needed for the zoom to work well.css("display", "flex").css("align-items", "center")@@ -285,7 +279,7 @@ async function renderImage(entity: FNote | FAttachment, $renderedContent: JQuery.css("flex-direction", "column"); // OCR text is displayed below the image.const $img = $("<img>")- .attr("src", url || "")+ .attr("src", getImageUrl(entity)).attr("id", `attachment-image-${idCounter++}`).css("max-width", "100%");@@ -298,6 +292,41 @@ async function renderImage(entity: FNote | FAttachment, $renderedContent: JQuery}}+/**+ * Mounts the zoom/pan {@link ImageViewer} for an image note or attachment. As with the media+ * player, the embedding caller must tear it down via {@link disposeInteractiveContent}.+ */+async function renderImageViewer(+ entity: FNote | FAttachment,+ $renderedContent: JQuery<HTMLElement>+) {+ const ImageViewer = (await import("../widgets/react/ImageViewer")).default;+ const $container = $('<div class="rendered-image-viewer">');+ const container = $container.get(0);+ if (container) {+ await mountInteractiveWidget(h(ImageViewer, {+ src: getImageUrl(entity),+ alt: entity.title,+ environment: "embedded"+ }), container);+ // The viewer's <img> takes no pointer events, so the menu goes on its container.+ imageContextMenuService.setupContextMenu($container);+ }+ $renderedContent.append($container);+}++function getImageUrl(entity: FNote | FAttachment) {+ const encodedTitle = encodeURIComponent(entity.title);++ if (entity instanceof FNote) {+ return `api/images/${entity.noteId}/${encodedTitle}?${Math.random()}`;+ } else if (entity instanceof FAttachment) {+ const { attachmentId, utcDateModified } = entity;+ return `api/attachments/${attachmentId}/image/${encodedTitle}?${utcDateModified}`;+ }+ return "";+}+async function addOCRTextIfAvailable(note: FNote, $content: JQuery<HTMLElement>) {try {const data = await server.get<TextRepresentationResponse>(`ocr/notes/${note.noteId}/text`);diff --git a/apps/client/src/stylesheets/style.css b/apps/client/src/stylesheets/style.cssindex b62022b96c..3811189ab9 100644--- a/apps/client/src/stylesheets/style.css+++ b/apps/client/src/stylesheets/style.css@@ -1561,7 +1561,7 @@ body.mobile .modal-content-with-sidebar > .modal-main > .modal-header > .modal-t}.include-note-content:not(:fullscreen) :is(- .rendered-content > img, .rendered-content > svg,+ .rendered-content > img, .rendered-content > svg, .image-viewer-content > img,.video-preview-wrapper:not(:fullscreen) > .video-preview) {max-height: var(--include-note-media-max-height, none);diff --git a/apps/client/src/widgets/react/ImageViewer.spec.tsx b/apps/client/src/widgets/react/ImageViewer.spec.tsxindex f560d2ec03..2f3c968825 100644--- a/apps/client/src/widgets/react/ImageViewer.spec.tsx+++ b/apps/client/src/widgets/react/ImageViewer.spec.tsx@@ -114,6 +114,31 @@ describe("ImageViewer", () => {expect(props.wheel).toEqual({ disabled: true });});+ it("pans at any scale standalone, but only once zoomed in when embedded in a note", () => {+ renderViewer({ src: "x" });+ expect(transformWrapperSpy.mock.lastCall?.[0].panning).toEqual({ disabled: false });++ // At the fitted size a drag scrolls the note.+ renderViewer({ src: "x", environment: "embedded" });+ const props = transformWrapperSpy.mock.lastCall?.[0];+ expect(props.panning).toEqual({ disabled: true });+ act(() => props.onTransform(null, { scale: 2 }));+ expect(transformWrapperSpy.mock.lastCall?.[0].panning).toEqual({ disabled: false });+ });++ it("keeps the zoom controls but drops the shortcut-hints button when embedded", async () => {+ const standalone = renderViewer({ src: "x" });+ await vi.waitFor(() => {+ expect(standalone.querySelector(".shortcut-hint-button-group")).not.toBeNull();+ });++ const embedded = renderViewer({ src: "x", environment: "embedded" });+ await vi.waitFor(() => {+ expect(embedded.querySelector(".image-viewer-controls")).not.toBeNull();+ });+ expect(embedded.querySelector(".shortcut-hint-button-group")).toBeNull();+ });+it("lets minScale and maxScale be overridden", () => {renderViewer({ src: "x", minScale: 1, maxScale: 8 });const props = transformWrapperSpy.mock.calls[0][0];diff --git a/apps/client/src/widgets/react/ImageViewer.tsx b/apps/client/src/widgets/react/ImageViewer.tsxindex 61ef198957..d8262869d7 100644--- a/apps/client/src/widgets/react/ImageViewer.tsx+++ b/apps/client/src/widgets/react/ImageViewer.tsx@@ -7,6 +7,9 @@ import { t } from "../../services/i18n";import type { ShortcutHintDefinition } from "../../services/shortcut_hints";import { isMobile } from "../../services/utils";import ShortcutHintButton from "../shortcut_hints/shortcut_hint_button";+import {+ isInScrollingDocument, type MediaEnvironment, usesCompactControls+} from "../type_widgets/file/media_environment";import ContentErrorMessage from "./ContentErrorMessage";import { useContextualShortcutHints } from "./hooks";import OverlayControlGroup, { ZoomControls } from "./OverlayControlGroup";@@ -22,6 +25,8 @@ interface ImageViewerProps {maxScale?: number;/** The shortcut hints to offer; defaults to zoom, pan and navigation between a folder's images. */shortcutHints?: ShortcutHintDefinition;+ /** Where it is mounted: `standalone` (default) in a pane of its own, `embedded` in a note. */+ environment?: MediaEnvironment;}/** Beyond this multiple of the image's native resolution, switch to crisp (non-smoothed) rendering. */@@ -59,8 +64,10 @@ export function evaluateImageZoom(scale: number, img: { naturalWidth: number; cl* (wheel/pinch/buttons/keyboard) and pan (drag/keyboard). Double-clicking resets to the fitted view.*/export default function ImageViewer({- src, imgClassName, alt = "", minScale = 0.5, maxScale = 50, shortcutHints = IMAGE_VIEWER_HINTS+ src, imgClassName, alt = "", minScale = 0.5, maxScale = 50, shortcutHints = IMAGE_VIEWER_HINTS,+ environment = "standalone"}: ImageViewerProps) {+ const isInDocument = isInScrollingDocument(environment);const [ pannable, setPannable ] = useState(false);const [ panning, setPanning ] = useState(false);const [ largeZoom, setLargeZoom ] = useState(false);@@ -122,7 +129,7 @@ export default function ImageViewer({}, [ src ]);useZoomPanKeyboard(zoom.ref, rootEl);- useZoomPanWheel(zoom.ref, rootEl);+ useZoomPanWheel(zoom.ref, rootEl, isInDocument);useContextualShortcutHints(shortcutHints);const wrapperClass = [@@ -149,6 +156,7 @@ export default function ImageViewer({centerOnInitcenterZoomedOutwheel={zoom.wheel}+ panning={{ disabled: isInDocument && !pannable }}autoAlignment={{ disabled: true }}doubleClick={{ mode: "reset" }}onTransform={zoom.onTransform}@@ -169,7 +177,7 @@ export default function ImageViewer({<ContentErrorMessage message={t("image_viewer.loading_error")} />)}- {!isMobile() && loaded && (+ {!usesCompactControls(environment) && !isMobile() && loaded && (<ShortcutHintButton />)}diff --git a/apps/client/src/widgets/react/zoom_pan.spec.ts b/apps/client/src/widgets/react/zoom_pan.spec.tsindex 4814231acd..a7342d2f4a 100644--- a/apps/client/src/widgets/react/zoom_pan.spec.ts+++ b/apps/client/src/widgets/react/zoom_pan.spec.ts@@ -1,6 +1,11 @@-import { describe, expect, it } from "vitest";+import { h, render } from "preact";+import { act } from "preact/test-utils";+import type { ReactZoomPanPinchRef } from "react-zoom-pan-pinch";+import { describe, expect, it, vi } from "vitest";-import { clampPan, wheelTargetScale, zoomStep, zoomToPointPosition } from "./zoom_pan";+import {+ clampPan, useZoomPanWheel, wheelTargetScale, zoomStep, zoomToPointPosition+} from "./zoom_pan";describe("zoomStep", () => {it("is the increment react-zoom-pan-pinch needs for a ×1.2 step, at any scale", () => {@@ -115,3 +120,67 @@ describe("zoomToPointPosition", () => {expect((cursorY - y) / scale1).toBeCloseTo((cursorY - posY0) / scale0);});});++describe("useZoomPanWheel", () => {+ function mountWheel(isFocusRequired: boolean) {+ const element = document.createElement("div");+ element.tabIndex = 0;+ document.body.appendChild(element);+ const api = {+ instance: { state: { scale: 1, positionX: 0, positionY: 0 }, wrapperComponent: null },+ zoomIn: vi.fn(),+ zoomOut: vi.fn(),+ setTransform: vi.fn()+ };+ const apiRef = { current: api as unknown as ReactZoomPanPinchRef };+ const host = document.createElement("div");+ function Harness() {+ useZoomPanWheel(apiRef, element, isFocusRequired);+ return null;+ }+ act(() => render(h(Harness, null), host));++ const unmount = () => {+ render(null, host);+ element.remove();+ };+ return { element, api, unmount };+ }++ function wheel(element: HTMLElement) {+ const event = new WheelEvent("wheel", { deltaY: -100, cancelable: true });+ element.dispatchEvent(event);+ return event;+ }++ it("zooms on the wheel without focus by default", () => {+ const { element, api, unmount } = mountWheel(false);+ expect(wheel(element).defaultPrevented).toBe(true);+ expect(api.zoomIn).toHaveBeenCalledOnce();+ unmount();+ });++ it("leaves the wheel to the page until the element has focus or is fullscreen", () => {+ const { element, api, unmount } = mountWheel(true);+ expect(wheel(element).defaultPrevented).toBe(false);+ expect(api.zoomIn).not.toHaveBeenCalled();++ element.focus();+ expect(wheel(element).defaultPrevented).toBe(true);+ expect(api.zoomIn).toHaveBeenCalledOnce();++ // happy-dom has no fullscreenElement.+ element.blur();+ Object.defineProperty(document, "fullscreenElement", {+ configurable: true,+ get: () => document.body+ });+ try {+ expect(wheel(element).defaultPrevented).toBe(true);+ expect(api.zoomIn).toHaveBeenCalledTimes(2);+ } finally {+ Reflect.deleteProperty(document, "fullscreenElement");+ unmount();+ }+ });+});diff --git a/apps/client/src/widgets/react/zoom_pan.ts b/apps/client/src/widgets/react/zoom_pan.tsindex 483a1c02aa..eab5514db8 100644--- a/apps/client/src/widgets/react/zoom_pan.ts+++ b/apps/client/src/widgets/react/zoom_pan.ts@@ -60,8 +60,14 @@ export function useZoomPanPinch({ minScale, maxScale, resetOn, onScaleChange }:* `zoomIn`/`zoomOut` take the increment up to that target, so the library still clamps to* `minScale`/`maxScale` and recomputes its bounds. It zooms toward the middle of the view, so the* `setTransform` that follows re-anchors the content under the pointer.+ *+ * With `isFocusRequired`, the wheel scrolls the page until `element` has focus or is fullscreen.*/-export function useZoomPanWheel(apiRef: RefObject<ReactZoomPanPinchRef>, element: HTMLElement | null) {+export function useZoomPanWheel(+ apiRef: RefObject<ReactZoomPanPinchRef>,+ element: HTMLElement | null,+ isFocusRequired = false+) {useEffect(() => {if (!element) return;@@ -69,6 +75,9 @@ export function useZoomPanWheel(apiRef: RefObject<ReactZoomPanPinchRef>, elementconst api = apiRef.current;// A purely horizontal wheel means no zoom; leave the event for anything else to use.if (!api || event.deltaY === 0) return;+ const isActive = element.contains(document.activeElement)+ || !!document.fullscreenElement?.contains(element);+ if (isFocusRequired && !isActive) return;event.preventDefault();const { scale, positionX, positionY } = api.instance.state;@@ -91,7 +100,7 @@ export function useZoomPanWheel(apiRef: RefObject<ReactZoomPanPinchRef>, elementelement.addEventListener("wheel", onWheel, { passive: false });return () => element.removeEventListener("wheel", onWheel);- }, [ apiRef, element ]);+ }, [ apiRef, element, isFocusRequired ]);}/** What one press of a zoom step multiplies the scale by. */diff --git a/apps/client/src/widgets/type_widgets/file/media_environment.spec.ts b/apps/client/src/widgets/type_widgets/file/media_environment.spec.tsindex 76f7c47b73..5cce0bb44d 100644--- a/apps/client/src/widgets/type_widgets/file/media_environment.spec.ts+++ b/apps/client/src/widgets/type_widgets/file/media_environment.spec.ts@@ -1,6 +1,9 @@import { describe, expect, it } from "vitest";-import { loadsEagerly, playerRootClasses, preloadFor, showsFileActions, showsViewportControls, usesCompactControls } from "./media_environment";+import {+ isInScrollingDocument, loadsEagerly, playerRootClasses, preloadFor, showsFileActions,+ showsViewportControls, usesCompactControls+} from "./media_environment";describe("media environment", () => {it("only a preview is lazy — it must not create a media element until the user asks for one", () => {@@ -38,4 +41,10 @@ describe("media environment", () => {expect(showsFileActions("preview")).toBe(false);expect(showsFileActions("standalone")).toBe(false);});++ it("places everything but the note detail inside a scrolling document", () => {+ expect(isInScrollingDocument("embedded")).toBe(true);+ expect(isInScrollingDocument("preview")).toBe(true);+ expect(isInScrollingDocument("standalone")).toBe(false);+ });});diff --git a/apps/client/src/widgets/type_widgets/file/media_environment.ts b/apps/client/src/widgets/type_widgets/file/media_environment.tsindex f178672391..b755fb0bb4 100644--- a/apps/client/src/widgets/type_widgets/file/media_environment.ts+++ b/apps/client/src/widgets/type_widgets/file/media_environment.ts@@ -1,7 +1,8 @@/**- * Where a media player is being rendered. A pane of its own — the note detail, or an attachment opened in- * full detail — is `standalone`; a note included in a text note or embedded in a canvas is `embedded`; a- * lightweight preview such as a collection tile or an attachment list is `preview`.+ * Where a media player or an image viewer is being rendered. A pane of its own — the note detail,+ * or an attachment opened in full detail — is `standalone`; a note included in a text note or+ * embedded in a canvas is `embedded`; a lightweight preview such as a collection tile or an+ * attachment list is `preview`.*/export type MediaEnvironment = "standalone" | "embedded" | "preview";@@ -50,6 +51,15 @@ export function showsViewportControls(environment: MediaEnvironment): boolean {return environment !== "preview";}+/**+ * Whether the content is inside a document that scrolls, such as a text note. A wheel or a+ * one-finger drag must keep scrolling that document, so an image viewer zooms on the wheel only+ * once focused and pans only once zoomed in.+ */+export function isInScrollingDocument(environment: MediaEnvironment): boolean {+ return environment !== "standalone";+}+/*** Whether the player carries the Download / Open-externally actions at the end of its own controls. An embed* is tight on height, so it takes them into the controls row instead of letting the content renderer appenddiff --git a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Note Types/Text/Include Note.html b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Note Types/Text/Include Note.htmlindex 94b29ed936..2bddf612ad 100644--- a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Note Types/Text/Include Note.html+++ b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Note Types/Text/Include Note.html@@ -112,4 +112,20 @@also display the results.</li><li><a class="reference-link" href="#root/_help_1vHRoWCEjj0L">Web View</a> providesan interactive preview of the website.</li>-</ul>\ No newline at end of file+</ul>+<h2>Included images</h2>+<p>An included image, whether an image note or an image attachment, is shown+ in the image viewer, which zooms and pans it:</p>+<ul>+ <li>To zoom, press the <span class="tn-icon bx bx-plus-circle"></span> <em>Zoom in</em> and <span+ class="tn-icon bx bx-minus-circle"></span> <em>Zoom out</em> buttons in the+ bottom-right corner of the image, or pinch on a touch screen. The percentage+ between them resets the zoom.</li>+ <li>To zoom with the mouse wheel, click the image first. Until then, the mouse+ wheel scrolls the note.</li>+ <li>To pan an image that is zoomed in, drag it. At its fitted size, dragging+ the image on a touch screen scrolls the note.</li>+ <li>To return to the fitted size, double-click the image.</li>+</ul>+<p>In a <em>Small</em> or <em>Medium</em> box, the image is scaled down to fit+ the height of the box. In fullscreen, it fits the screen.</p>\ No newline at end of filediff --git a/docs/User Guide/User Guide/Note Types/Text/Include Note.md b/docs/User Guide/User Guide/Note Types/Text/Include Note.mdindex 62d0642799..63000afe6b 100644--- a/docs/User Guide/User Guide/Note Types/Text/Include Note.md+++ b/docs/User Guide/User Guide/Note Types/Text/Include Note.md@@ -74,4 +74,15 @@ Since v0.104.0, included notes might become interactive depending on their note* <a class="reference-link" href="../../Collections.md">Collections</a> (e.g. <a class="reference-link" href="../../Collections/Geo%20Map.md">Geo Map</a>) will render fully interactive, including creating new notes.* <a class="reference-link" href="../Saved%20Search.md">Saved Search</a> will also display the results.-* <a class="reference-link" href="../Web%20View.md">Web View</a> provides an interactive preview of the website.\ No newline at end of file+* <a class="reference-link" href="../Web%20View.md">Web View</a> provides an interactive preview of the website.++## Included images++An included image, whether an image note or an image attachment, is shown in the image viewer, which zooms and pans it:++* To zoom, press the <span class="tn-icon bx bx-plus-circle"></span> _Zoom in_ and <span class="tn-icon bx bx-minus-circle"></span> _Zoom out_ buttons in the bottom-right corner of the image, or pinch on a touch screen. The percentage between them resets the zoom.+* To zoom with the mouse wheel, click the image first. Until then, the mouse wheel scrolls the note.+* To pan an image that is zoomed in, drag it. At its fitted size, dragging the image on a touch screen scrolls the note.+* To return to the fitted size, double-click the image.++In a _Small_ or _Medium_ box, the image is scaled down to fit the height of the box. In fullscreen, it fits the screen.\ No newline at end of file