Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
feat(editor): MUL-5752 image preview prev/next navigation (#6424)
Naiyuan Qing3e1a7e0404ce
diff --git a/apps/mobile/components/chat/chat-message-list.tsx b/apps/mobile/components/chat/chat-message-list.tsxindex e1558121cc..7d9fd95a37 100644--- a/apps/mobile/components/chat/chat-message-list.tsx+++ b/apps/mobile/components/chat/chat-message-list.tsx@@ -40,7 +40,7 @@* `startRenderingFromBottom` (initial paint at bottom, no setTimeout* hacks). Cell recycling also keeps scroll-up smooth.*/-import { useState } from "react";+import { useMemo, useState } from "react";import { ActivityIndicator, Pressable, View } from "react-native";import { FlashList } from "@shopify/flash-list";import { Ionicons } from "@expo/vector-icons";@@ -55,6 +55,7 @@ import type { AgentAvailability } from "@multica/core/agents";import { taskMessagesOptions } from "@/data/queries/chat";import { Text } from "@/components/ui/text";import { Markdown } from "@/lib/markdown";+import { ImageSequenceProvider } from "@/lib/markdown/image-sequence";import { failureReasonLabel } from "@/lib/failure-reason-label";import { formatElapsedMs } from "@/lib/format-elapsed";import { cn } from "@/lib/utils";@@ -117,6 +118,25 @@ export function ChatMessageList({// passes through to the list cells / bubble long-press wrappers normally.const selectingId = useChatSelectStore((s) => s.selectingId);+ // Every image in this session, in message order (MUL-5752), so tapping one+ // opens the lightbox at its position and a swipe walks the rest.+ //+ // Above the loading / empty early returns because hooks must run on every+ // render — an empty `messages` just yields an empty block list.+ //+ // Persisted messages only — same boundary web draws: a task transcript's+ // images live behind a separate cache and inside a folded section, so they+ // keep opening on their own rather than joining a sequence the reader+ // cannot see the rest of.+ const imageBlocks = useMemo(+ () =>+ messages.map((message) => ({+ content: message.content,+ attachments: message.attachments,+ })),+ [messages],+ );+if (loading && messages.length === 0) {return (<View className="flex-1 items-center justify-center">@@ -161,6 +181,7 @@ export function ChatMessageList({// `if (isSelecting) return body;`), so taps on the selected bubble// also dismiss, matching iOS Notes / iMessage behaviour. Scroll// gestures are unaffected (Pressable only intercepts non-drag taps).+ <ImageSequenceProvider blocks={imageBlocks}><PressableonPress={selectingId@@ -232,6 +253,7 @@ export function ChatMessageList({keyboardShouldPersistTaps="handled"/></Pressable>+ </ImageSequenceProvider>);}diff --git a/apps/mobile/components/issue/timeline-list.tsx b/apps/mobile/components/issue/timeline-list.tsxindex 990f137bdf..fee16f0a76 100644--- a/apps/mobile/components/issue/timeline-list.tsx+++ b/apps/mobile/components/issue/timeline-list.tsx@@ -87,6 +87,7 @@ import {} from "react-native";import { FlashList, type FlashListRef } from "@shopify/flash-list";import { Ionicons } from "@expo/vector-icons";+import { useQuery } from "@tanstack/react-query";import type { Issue, TimelineEntry } from "@multica/core/types";import { Text } from "@/components/ui/text";import { IssueHeaderCard } from "./issue-header-card";@@ -97,6 +98,10 @@ import { CommentCard } from "./comment-card";import { useLastViewedStore } from "@/data/stores/last-viewed-store";import { coalesceTimeline } from "@/lib/timeline-coalesce";import { buildTimelineRows, type TimelineRow } from "@/lib/timeline-thread";+import { ImageSequenceProvider } from "@/lib/markdown/image-sequence";+import { issueAttachmentsOptions } from "@/data/queries/issues";+import { useWorkspaceStore } from "@/data/workspace-store";+import type { ImageSequenceBlock } from "@multica/core/attachments/image-sequence";import { useColorScheme } from "@/lib/use-color-scheme";import { THEME } from "@/lib/theme";import { useCommentSelectStore } from "@/data/comment-select-store";@@ -159,6 +164,33 @@ export function TimelineList({return buildTimelineRows(coalesceTimeline(entries));}, [entries]);+ // Every image on this screen, in render order: the description first, then+ // each comment row with its replies (MUL-5752). Tapping any of them opens+ // the lightbox at its real position so a swipe walks to the next.+ //+ // The description's attachments come from the same query IssueDescription+ // uses — TanStack Query dedupes it, so this adds no request.+ const wsId = useWorkspaceStore((s) => s.currentWorkspaceId);+ const { data: issueAttachments } = useQuery(+ issueAttachmentsOptions(wsId, issue.id),+ );+ const imageBlocks = useMemo<ImageSequenceBlock[]>(() => {+ const blocks: ImageSequenceBlock[] = [+ { content: issue.description, attachments: issueAttachments },+ ];+ for (const row of data) {+ if (row.entry.type !== "comment") continue;+ blocks.push({+ content: row.entry.content,+ attachments: row.entry.attachments,+ });+ for (const reply of row.replies) {+ blocks.push({ content: reply.content, attachments: reply.attachments });+ }+ }+ return blocks;+ }, [issue.description, issueAttachments, data]);+const listRef = useRef<FlashListRef<TimelineRow>>(null);// Gates single-shot per (commentId, nonce) tuple. Re-tap from inbox// bumps the nonce → ref no longer matches → effect re-fires.@@ -357,6 +389,7 @@ export function TimelineList({: "list";return (+ <ImageSequenceProvider blocks={imageBlocks}><View className="flex-1">{/* Outer Pressable owns the "tap anywhere outside the selectedcomment to exit text-selection mode" gesture. Disabled when@@ -445,6 +478,7 @@ export function TimelineList({<NewCommentChip count={newCount} onPress={onJumpToNew} />) : null}</View>+ </ImageSequenceProvider>);}diff --git a/apps/mobile/lib/markdown/image-sequence.tsx b/apps/mobile/lib/markdown/image-sequence.tsxnew file mode 100644index 0000000000..31d2d7c665--- /dev/null+++ b/apps/mobile/lib/markdown/image-sequence.tsx@@ -0,0 +1,57 @@+/**+ * Screen-scoped image sequence for the lightbox (MUL-5752).+ *+ * A screen that can show several images (an issue: description + every+ * comment; a chat session: every message) mounts this once with its blocks in+ * render order. Every `MarkdownImage` below it then opens the lightbox+ * positioned inside that sequence instead of on its own, so a swipe walks to+ * the next image and the viewer can say "3 / 7".+ *+ * Mirrors the web/desktop `ImageSequenceProvider`+ * (packages/views/editor/image-sequence-context.tsx) — same product contract,+ * different presentation. The ordering itself is NOT re-derived here: both+ * clients call `collectImageSequence` from @multica/core so an issue's images+ * are counted the same way on every client (mobile parity rule: mirror the+ * shared logic, own the UI).+ *+ * The URIs are resolved the same way `MarkdownImage` resolves the one it+ * renders — same attachment match, same `resolveAttachmentUrl` pass — so the+ * URI a tap reports is the one the sequence holds.+ */+import { createContext, use, useMemo, type ReactNode } from "react";+import {+ collectImageSequence,+ type ImageSequenceBlock,+} from "@multica/core/attachments/image-sequence";+import { resolveAttachmentUrl } from "@/lib/attachment-url";++const ImageSequenceContext = createContext<readonly string[]>([]);++/**+ * Resolved image URIs for the surrounding screen, in render order. Empty when+ * no provider is mounted — the lightbox then shows the tapped image alone.+ */+export function useImageSequence(): readonly string[] {+ return use(ImageSequenceContext);+}++export function ImageSequenceProvider({+ blocks,+ children,+}: {+ blocks: ReadonlyArray<ImageSequenceBlock | null | undefined>;+ children: ReactNode;+}) {+ const uris = useMemo(+ () =>+ collectImageSequence(blocks).map(+ (item) => resolveAttachmentUrl(item.url) ?? item.url,+ ),+ [blocks],+ );+ return (+ <ImageSequenceContext.Provider value={uris}>+ {children}+ </ImageSequenceContext.Provider>+ );+}diff --git a/apps/mobile/lib/markdown/lightbox-provider.tsx b/apps/mobile/lib/markdown/lightbox-provider.tsxindex fccd3d4f0d..e6a31fadb1 100644--- a/apps/mobile/lib/markdown/lightbox-provider.tsx+++ b/apps/mobile/lib/markdown/lightbox-provider.tsx@@ -5,15 +5,34 @@* displays the image fullscreen with pinch-to-zoom, double-tap, and* swipe-down-to-dismiss — all handled by `react-native-image-viewing`.*- * V2.1 only opens single images. A future iteration could collect every- * `![]()` URL while rendering a comment and pass the array through so- * a left/right swipe walks the gallery.+ * `open(uri, sequence)` opens the same viewer positioned inside a whole+ * screen's images (MUL-5752), so a horizontal swipe walks to the next one+ * and a "3 / 7" counter says where the reader is. `ImageSequenceProvider`+ * builds that array; screens that don't mount one keep passing a single URI+ * and get the previous single-image behaviour.+ *+ * Parity with web/desktop, all from the same product brief:+ * - images only, never mixed with other attachment kinds;+ * - the sequence is frozen when the viewer opens, so an arriving comment+ * cannot shift the index under the reader;+ * - boundaries stop rather than wrap. `react-native-image-viewing` pages a+ * fixed array and does not loop, so this comes for free.+ *+ * The gesture is the platform's own horizontal paging rather than the+ * desktop chevrons — same semantics, phone-native interaction.*/-import { createContext, use, useState, type ReactNode } from "react";+import { createContext, use, useMemo, useState, type ReactNode } from "react";+import { View } from "react-native";import ImageView from "react-native-image-viewing";+import { Text } from "@/components/ui/text";interface LightboxApi {- open: (uri: string) => void;+ /**+ * Show `uri` fullscreen. When `sequence` contains it, the viewer opens at+ * its real position and the reader can swipe through the rest; otherwise+ * the viewer shows that one image.+ */+ open: (uri: string, sequence?: readonly string[]) => void;}const LightboxContext = createContext<LightboxApi>({@@ -27,18 +46,61 @@ export function useLightbox(): LightboxApi {return use(LightboxContext);}+interface Viewing {+ images: { uri: string }[];+ index: number;+}+export function LightboxProvider({ children }: { children: ReactNode }) {- const [images, setImages] = useState<{ uri: string }[]>([]);- const open = (uri: string) => setImages([{ uri }]);- const close = () => setImages([]);+ const [viewing, setViewing] = useState<Viewing | null>(null);+ // Tracked separately from `viewing.index` so the counter follows a swipe;+ // `viewing` itself is the frozen snapshot taken when the viewer opened.+ const [currentIndex, setCurrentIndex] = useState(0);++ const api = useMemo<LightboxApi>(+ () => ({+ open: (uri, sequence) => {+ const uris = sequence?.length ? [...sequence] : [uri];+ const found = uris.indexOf(uri);+ // A URI the sequence doesn't know still opens, on its own — same+ // fallback web takes when `openAt` reports the key is unknown.+ const images = found >= 0 ? uris : [uri];+ const index = found >= 0 ? found : 0;+ setCurrentIndex(index);+ setViewing({ images: images.map((u) => ({ uri: u })), index });+ },+ }),+ [],+ );++ const total = viewing?.images.length ?? 0;+ // Only a sequence gets a counter — a lone image has nothing to count.+ const Footer = useMemo(+ () =>+ total > 1+ ? function LightboxCounter() {+ return (+ <View className="items-center pb-10">+ <Text className="text-sm text-white">+ {currentIndex + 1} / {total}+ </Text>+ </View>+ );+ }+ : undefined,+ [currentIndex, total],+ );+return (- <LightboxContext.Provider value={{ open }}>+ <LightboxContext.Provider value={api}>{children}<ImageView- images={images}- imageIndex={0}- visible={images.length > 0}- onRequestClose={close}+ images={viewing?.images ?? []}+ imageIndex={viewing?.index ?? 0}+ visible={!!viewing}+ onRequestClose={() => setViewing(null)}+ onImageIndexChange={setCurrentIndex}+ FooterComponent={Footer}/></LightboxContext.Provider>);diff --git a/apps/mobile/lib/markdown/markdown-image.tsx b/apps/mobile/lib/markdown/markdown-image.tsxindex c13746781b..61e52eaaad 100644--- a/apps/mobile/lib/markdown/markdown-image.tsx+++ b/apps/mobile/lib/markdown/markdown-image.tsx@@ -28,8 +28,10 @@ import { useEffect, useMemo, useState } from "react";import { Image as RNImage, Pressable, View } from "react-native";import { Image as ExpoImage } from "expo-image";import type { Attachment } from "@multica/core/types";+import { matchAttachmentByURL } from "@multica/core/attachments/image-sequence";import { resolveAttachmentUrl } from "@/lib/attachment-url";import { useLightbox } from "./lightbox-provider";+import { useImageSequence } from "./image-sequence";interface Props {uri: string;@@ -39,17 +41,22 @@ interface Props {export function MarkdownImage({ uri, attachments }: Props) {const { open } = useLightbox();+ const sequence = useImageSequence();const [aspect, setAspect] = useState<number | null>(null);const resolvedUri = useMemo(() => {- // mc://file/<id> → look up the matching attachment's download_url.+ // mc://file/<id> → look up the matching attachment's loadable URL.// No match (external link, html https URL, or unresolved mc://) falls// through to the original uri.- let candidate: string | null | undefined = uri;- if (attachments && attachments.length > 0) {- const match = attachments.find((a) => a.url === uri);- if (match?.download_url) candidate = match.download_url;- }+ //+ // `matchAttachmentByURL` + this URL pick are the ones the shared sequence+ // builder uses, so the URI a tap reports is byte-identical to the one+ // `ImageSequenceProvider` put in the array — otherwise the lightbox could+ // not find its position and would silently drop back to a single image.+ const match = matchAttachmentByURL(uri, attachments);+ const candidate: string | null | undefined = match+ ? match.download_url || match.markdown_url || match.url+ : uri;// The backend may return a server-relative `download_url` (e.g.// `/api/attachments/{id}/download`) when no CloudFront signer is// configured — see MUL-2976. RN's image loader has no document@@ -80,7 +87,7 @@ export function MarkdownImage({ uri, attachments }: Props) {}, [resolvedUri]);return (- <Pressable onPress={() => open(resolvedUri)}>+ <Pressable onPress={() => open(resolvedUri, sequence)}><View className="rounded-lg overflow-hidden bg-muted"><ExpoImagesource={{ uri: resolvedUri }}diff --git a/packages/core/attachments/image-sequence.test.ts b/packages/core/attachments/image-sequence.test.tsnew file mode 100644index 0000000000..29e7110232--- /dev/null+++ b/packages/core/attachments/image-sequence.test.ts@@ -0,0 +1,216 @@+import { describe, expect, it } from "vitest";+import type { Attachment } from "../types/attachment";+import {+ collectImageSequence,+ indexOfImageKey,+ isImageAttachment,+ matchAttachmentByURL,+ selectStandaloneAttachments,+} from "./image-sequence";++function attachment(over: Partial<Attachment> & { id: string }): Attachment {+ return {+ workspace_id: "ws",+ issue_id: null,+ comment_id: null,+ chat_session_id: null,+ chat_message_id: null,+ uploader_type: "member",+ uploader_id: "u1",+ filename: "shot.png",+ url: `https://cdn.example.com/${over.id}.png`,+ download_url: `/api/attachments/${over.id}/download`,+ markdown_url: `https://api.example.com/api/attachments/${over.id}/download`,+ content_type: "image/png",+ size_bytes: 100,+ created_at: "2026-08-05T00:00:00Z",+ ...over,+ } as Attachment;+}++const UUID_A = "11111111-1111-4111-8111-111111111111";+const UUID_B = "22222222-2222-4222-8222-222222222222";+const UUID_C = "33333333-3333-4333-8333-333333333333";++describe("isImageAttachment", () => {+ it("accepts image content types and image extensions", () => {+ expect(isImageAttachment("image/png", "")).toBe(true);+ expect(isImageAttachment("image/svg+xml; charset=utf-8", "a")).toBe(true);+ expect(isImageAttachment("", "diagram.WEBP")).toBe(true);+ expect(isImageAttachment("", "https://cdn/x/y.jpg?sig=abc")).toBe(true);+ });++ it("rejects everything else", () => {+ expect(isImageAttachment("application/pdf", "report.pdf")).toBe(false);+ expect(isImageAttachment("video/mp4", "clip.mp4")).toBe(false);+ expect(isImageAttachment("", "notes")).toBe(false);+ expect(isImageAttachment("", "archive.tar.gz")).toBe(false);+ });+});++describe("matchAttachmentByURL", () => {+ const a = attachment({ id: UUID_A });++ it("matches the stable download path regardless of host and query", () => {+ expect(+ matchAttachmentByURL(+ `https://other-host/api/attachments/${UUID_A}/download?x=1`,+ [a],+ ),+ ).toBe(a);+ });++ it("falls back to legacy full-URL equality", () => {+ const legacy = attachment({+ id: UUID_B,+ download_url: "",+ markdown_url: "",+ url: "/uploads/k?exp=1&sig=2",+ });+ expect(matchAttachmentByURL("/uploads/k?exp=9&sig=9", [legacy])).toBe(legacy);+ });++ it("returns undefined for unrelated URLs", () => {+ expect(matchAttachmentByURL("https://example.com/x.png", [a])).toBeUndefined();+ });+});++describe("selectStandaloneAttachments", () => {+ it("drops attachments already referenced inline", () => {+ const inline = attachment({ id: UUID_A, filename: "inline.png" });+ const alone = attachment({ id: UUID_B, filename: "alone.png" });+ const content = ``;+ expect(+ selectStandaloneAttachments(content, [inline, alone]).map((a) => a.id),+ ).toEqual([UUID_B]);+ });++ it("drops a duplicate upload of a file that is already inline", () => {+ const inline = attachment({ id: UUID_A, filename: "same.png" });+ const dupe = attachment({ id: UUID_B, filename: "same.png" });+ const content = ``;+ expect(selectStandaloneAttachments(content, [inline, dupe])).toEqual([]);+ });++ it("keeps everything when there is no content", () => {+ const a = attachment({ id: UUID_A });+ expect(selectStandaloneAttachments("", [a])).toEqual([a]);+ });+});++describe("collectImageSequence", () => {+ it("orders inline images by position, then the standalone cards", () => {+ const inlineA = attachment({ id: UUID_A, filename: "a.png" });+ const inlineB = attachment({ id: UUID_B, filename: "b.png" });+ const standalone = attachment({ id: UUID_C, filename: "c.png" });++ const sequence = collectImageSequence([+ {+ content: [+ ``,+ "text between",+ ``,+ ].join("\n\n"),+ attachments: [inlineA, inlineB, standalone],+ },+ ]);++ expect(sequence.map((i) => i.key)).toEqual([UUID_B, UUID_A, UUID_C]);+ expect(sequence[0]?.attachment).toBe(inlineB);+ });++ it("walks blocks in order and de-duplicates repeats", () => {+ const shared = attachment({ id: UUID_A });+ const sequence = collectImageSequence([+ { content: ``, attachments: [shared] },+ { content: "no images here" },+ { content: ``, attachments: [shared] },+ { content: "" },+ ]);+ expect(sequence.map((i) => i.key)).toEqual([+ UUID_A,+ "https://example.com/pic.png",+ ]);+ });++ it("keeps unresolved markdown images, keyed by their URL", () => {+ const sequence = collectImageSequence([+ { content: '' },+ ]);+ expect(sequence).toEqual([+ {+ key: "https://cdn/x.png",+ url: "https://cdn/x.png",+ filename: "shot",+ attachment: undefined,+ },+ ]);+ });++ it("excludes non-image attachments entirely", () => {+ const pdf = attachment({+ id: UUID_A,+ filename: "report.pdf",+ content_type: "application/pdf",+ });+ const video = attachment({+ id: UUID_B,+ filename: "clip.mp4",+ content_type: "video/mp4",+ });+ const image = attachment({ id: UUID_C });+ expect(+ collectImageSequence([{ attachments: [pdf, video, image] }]).map(+ (i) => i.key,+ ),+ ).toEqual([UUID_C]);+ });++ it("ignores image syntax inside fenced blocks and code spans", () => {+ const sequence = collectImageSequence([+ {+ content: [+ "How to embed one:",+ "```md",+ "",+ "```",+ "and inline `` too",+ "",+ ].join("\n"),+ },+ ]);+ expect(sequence.map((i) => i.key)).toEqual(["https://cdn/yes.png"]);+ });++ it("reads raw <img> tags and image-named file cards", () => {+ const sequence = collectImageSequence([+ {+ content: [+ '<img src="https://cdn/raw.png" alt="raw">',+ `!file[chart.png](/api/attachments/${UUID_A}/download)`,+ `!file[notes.txt](/api/attachments/${UUID_B}/download)`,+ ].join("\n\n"),+ },+ ]);+ expect(sequence.map((i) => i.key)).toEqual([+ "https://cdn/raw.png",+ `/api/attachments/${UUID_A}/download`,+ ]);+ });++ it("returns an empty sequence for empty input", () => {+ expect(collectImageSequence([])).toEqual([]);+ expect(collectImageSequence([null, undefined, {}])).toEqual([]);+ });+});++describe("indexOfImageKey", () => {+ it("finds a key and reports -1 for anything else", () => {+ const items = collectImageSequence([+ { content: "\n\n" },+ ]);+ expect(indexOfImageKey(items, "https://cdn/b.png")).toBe(1);+ expect(indexOfImageKey(items, "https://cdn/missing.png")).toBe(-1);+ expect(indexOfImageKey(items, "")).toBe(-1);+ });+});diff --git a/packages/core/attachments/image-sequence.ts b/packages/core/attachments/image-sequence.tsnew file mode 100644index 0000000000..0aa0e57405--- /dev/null+++ b/packages/core/attachments/image-sequence.ts@@ -0,0 +1,370 @@+/**+ * Image sequence — the ordered list of images one surface exposes to the+ * preview viewer's prev / next navigation (MUL-5752).+ *+ * Scope is deliberately narrow: ONLY images. PDFs, video, audio, markdown,+ * HTML and text attachments never enter this sequence — mixing kinds would+ * mean defining per-kind load/keyboard/state semantics for a "next" that can+ * land on a PDF page or a playing video. A non-image attachment simply keeps+ * opening its own single-file preview.+ *+ * The sequence is built from DATA, not from the DOM: both the issue timeline+ * and the chat message list are virtualized, so a registry of mounted <img>+ * nodes would silently drop every image scrolled out of the window. Feeding it+ * the same `{ content, attachments }` blocks the renderers consume keeps the+ * order identical to what the reader sees without depending on what is+ * currently painted.+ *+ * Pure — no React, no DOM, no platform APIs. Mobile shares it (see+ * apps/mobile/CLAUDE.md: pure functions from @multica/core are importable).+ */++import type { Attachment } from "../types/attachment";+import {+ attachmentIdFromDownloadURL,+ contentReferencesAttachment,+} from "../types/attachment-url";++// Extension fallback for the image test. Mirrors IMAGE_EXTS in+// packages/views/editor/utils/preview.ts, which now delegates here so the+// "is this an image?" answer cannot drift between the preview dispatch table+// and the sequence builder.+const IMAGE_EXTENSIONS = new Set<string>([+ "png",+ "jpg",+ "jpeg",+ "gif",+ "webp",+ "avif",+ "bmp",+ "ico",+ "svg",+]);++function extensionOf(filename: string): string {+ const base = (filename ?? "").toLowerCase().split(/[\\/]/).pop() ?? "";+ const withoutQuery = base.split(/[?#]/, 1)[0] ?? "";+ const dot = withoutQuery.lastIndexOf(".");+ if (dot <= 0) return "";+ return withoutQuery.slice(dot + 1);+}++function normalizeContentType(contentType: string): string {+ const ct = (contentType ?? "").toLowerCase().trim();+ const semi = ct.indexOf(";");+ return (semi >= 0 ? ct.slice(0, semi) : ct).trim();+}++/**+ * True when the file renders as an image. Content-type wins; the extension is+ * the fallback for URL-only sources that carry no server metadata.+ *+ * NOTE for callers implementing a full kind dispatch: this is only the image+ * branch. `application/pdf`, `video/*` and `audio/*` must be tested BEFORE+ * this (an `.svg` is text-like XML, a `.pdf` named `chart.pdf.png` is not a+ * real case) — see `getPreviewKind`.+ */+export function isImageAttachment(+ contentType: string,+ filename: string,+): boolean {+ if (normalizeContentType(contentType).startsWith("image/")) return true;+ const ext = extensionOf(filename);+ return ext !== "" && IMAGE_EXTENSIONS.has(ext);+}++// ---------------------------------------------------------------------------+// URL → attachment matching+// ---------------------------------------------------------------------------++function stripQueryAndFragment(url: string): string {+ return url.split(/[?#]/, 1)[0] ?? "";+}++function matchesAttachmentURL(+ embeddedURL: string,+ attachmentURL?: string,+): boolean {+ if (!embeddedURL || !attachmentURL) return false;+ if (embeddedURL === attachmentURL) return true;+ const embeddedStable = stripQueryAndFragment(embeddedURL);+ const attachmentStable = stripQueryAndFragment(attachmentURL);+ return embeddedStable !== "" && embeddedStable === attachmentStable;+}++/**+ * Resolve a URL embedded in a markdown body back to its attachment record.+ *+ * Two fallbacks, in order — the same pair `AttachmentDownloadProvider` uses+ * (and now shares with this module so a URL can never resolve to one record+ * for the download click and another for the sequence):+ *+ * 1. id extracted from the stable `/api/attachments/<id>/download` shape+ * that every post-MUL-3130 body persists. Survives a host swap and any+ * incidental query / fragment.+ * 2. full-URL equality against `url` / `download_url` / `markdown_url`, for+ * legacy bodies and CDN markdown that never got the stable shape.+ */+export function matchAttachmentByURL(+ url: string,+ attachments: ReadonlyArray<Attachment> | null | undefined,+): Attachment | undefined {+ if (!url || !attachments?.length) return undefined;+ const idFromUrl = attachmentIdFromDownloadURL(url);+ if (idFromUrl) {+ const byId = attachments.find((a) => a.id === idFromUrl);+ if (byId) return byId;+ }+ return attachments.find(+ (a) =>+ matchesAttachmentURL(url, a.url) ||+ matchesAttachmentURL(url, a.download_url) ||+ matchesAttachmentURL(url, a.markdown_url),+ );+}++/**+ * The attachments a surface renders as cards BELOW the body — i.e. the ones+ * the markdown does not already reference inline.+ *+ * Also drops a re-upload of a file that is already inline under a different+ * attachment row (same name + type + size): the reader sees one image, so the+ * sequence must count one.+ */+export function selectStandaloneAttachments(+ content: string | null | undefined,+ attachments: ReadonlyArray<Attachment> | null | undefined,+): Attachment[] {+ if (!attachments?.length) return [];+ if (!content) return [...attachments];+ return attachments.filter((a) => {+ if (contentReferencesAttachment(content, a)) return false;+ const hasSiblingInContent = attachments.some(+ (other) =>+ other.id !== a.id &&+ other.filename === a.filename &&+ other.content_type === a.content_type &&+ other.size_bytes === a.size_bytes &&+ contentReferencesAttachment(content, other),+ );+ return !hasSiblingInContent;+ });+}++// ---------------------------------------------------------------------------+// Inline image references+// ---------------------------------------------------------------------------++function blankOut(text: string): string {+ // Newlines survive so line-anchored patterns below keep their line numbers.+ return text.replace(/[^\n]/g, " ");+}++/**+ * Blank every code span and fenced block, preserving offsets and line breaks.+ *+ * Without this, an `` shown as an EXAMPLE inside a fenced block —+ * common in agent replies explaining markdown — would be counted as a real+ * image and the reader would page onto something that was never rendered.+ *+ * Line scanner rather than one multiline regex: a backreferenced+ * `(`{3,})[\s\S]*?\1` over agent output is a ReDoS shape, and this runs on+ * every issue/chat render.+ */+function maskCode(content: string): string {+ const lines = content.split("\n");+ let fence: string | null = null;+ for (let i = 0; i < lines.length; i++) {+ const line = lines[i]!;+ const fenceMatch = /^[ \t]{0,3}(`{3,}|~{3,})/.exec(line);+ if (fence !== null) {+ lines[i] = blankOut(line);+ const closes =+ fenceMatch !== null &&+ fenceMatch[1]![0] === fence[0] &&+ fenceMatch[1]!.length >= fence.length;+ if (closes) fence = null;+ continue;+ }+ if (fenceMatch !== null) {+ fence = fenceMatch[1]!;+ lines[i] = blankOut(line);+ continue;+ }+ lines[i] = line.replace(/(`+)[^`\n]*?\1/g, blankOut);+ }+ return lines.join("\n");+}++interface InlineImageRef {+ index: number;+ url: string;+ /** Best filename hint available at the reference site. */+ filename: string;+ /**+ * Whether the reference still has to pass the image test. Markdown `![]()`+ * and `<img>` are images by construction (the renderers pass+ * `forceKind: "image"`); a `!file[name](url)` card only renders as an image+ * when its name/type says so.+ */+ requiresImageCheck: boolean;+}++// ``. The URL char class stops at whitespace and `)` so a+// title never leaks into it; the optional <> wrapper is CommonMark's escape+// for URLs containing spaces.+const MARKDOWN_IMAGE_RE =+ /!\[([^\]\n]*)\]\(\s*<([^>\n]*)>[^)]*\)|!\[([^\]\n]*)\]\(\s*([^)\s]+)[^)]*\)/g;++// Raw `<img src=...>` — reachable because the readonly renderer runs+// rehypeRaw + rehypeSanitize, and the sanitize schema keeps img.+const HTML_IMAGE_RE =+ /<img\b[^>]*?\ssrc\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s">']+))[^>]*>/gi;++// `!file[name](url)` on its own line — `preprocessFileCards` turns it into a+// fileCard div, which the renderer hands to <Attachment>; an image filename+// there renders as an inline image, not a card.+const FILE_CARD_LINE_RE = /^[ \t]*!file\[((?:\\.|[^\]\\\n])*)\]\(([^)\s]+)\)[ \t]*$/gm;++function unescapeLabel(label: string): string {+ return label.replace(/\\([[\]\\()])/g, "$1");+}++function extractInlineImageRefs(rawContent: string): InlineImageRef[] {+ if (!rawContent) return [];+ const content = maskCode(rawContent);+ const refs: InlineImageRef[] = [];++ for (const m of content.matchAll(MARKDOWN_IMAGE_RE)) {+ // Two alternations: `<...>`-wrapped URL (groups 1/2) or bare (groups 3/4).+ const alt = m[1] ?? m[3] ?? "";+ const url = (m[2] ?? m[4] ?? "").trim();+ if (!url) continue;+ refs.push({+ index: m.index ?? 0,+ url,+ filename: unescapeLabel(alt),+ requiresImageCheck: false,+ });+ }++ for (const m of content.matchAll(HTML_IMAGE_RE)) {+ const url = (m[1] ?? m[2] ?? m[3] ?? "").trim();+ if (!url) continue;+ refs.push({+ index: m.index ?? 0,+ url,+ filename: "",+ requiresImageCheck: false,+ });+ }++ for (const m of content.matchAll(FILE_CARD_LINE_RE)) {+ const url = (m[2] ?? "").trim();+ if (!url) continue;+ refs.push({+ index: m.index ?? 0,+ url,+ filename: unescapeLabel(m[1] ?? ""),+ requiresImageCheck: true,+ });+ }++ return refs.sort((a, b) => a.index - b.index);+}++// ---------------------------------------------------------------------------+// Sequence+// ---------------------------------------------------------------------------++/** One image the viewer can page to. */+export interface ImageSequenceItem {+ /**+ * Identity used to open the sequence at the clicked image. The attachment id+ * when the reference resolves to a record, otherwise the URL as written in+ * the body — matching what the renderer knows at click time.+ */+ key: string;+ /** Best-known URL. Callers holding `attachment` should prefer re-resolving. */+ url: string;+ filename: string;+ /** Present when the reference resolved to a workspace attachment record. */+ attachment?: Attachment;+}++/** One renderable unit: an issue description, a comment, a chat message. */+export interface ImageSequenceBlock {+ content?: string | null;+ attachments?: ReadonlyArray<Attachment> | null;+}++/**+ * Flatten blocks into the ordered image sequence a viewer walks.+ *+ * Order is render order: for each block, images inline in the body in text+ * order, then the standalone attachment cards rendered under it. Repeats of+ * the same image collapse to their first position, so the counter matches the+ * number of distinct images rather than the number of references.+ */+export function collectImageSequence(+ blocks: ReadonlyArray<ImageSequenceBlock | null | undefined>,+): ImageSequenceItem[] {+ const items: ImageSequenceItem[] = [];+ const seen = new Set<string>();++ const push = (item: ImageSequenceItem) => {+ if (!item.key || seen.has(item.key)) return;+ seen.add(item.key);+ items.push(item);+ };++ for (const block of blocks) {+ if (!block) continue;+ const content = block.content ?? "";+ const attachments = block.attachments ?? [];++ for (const ref of extractInlineImageRefs(content)) {+ const attachment = matchAttachmentByURL(ref.url, attachments);+ if (ref.requiresImageCheck) {+ const isImage = attachment+ ? isImageAttachment(attachment.content_type, attachment.filename)+ : isImageAttachment("", ref.filename || ref.url);+ if (!isImage) continue;+ }+ push({+ key: attachment?.id ?? ref.url,+ url:+ attachment?.download_url ||+ attachment?.markdown_url ||+ attachment?.url ||+ ref.url,+ filename: attachment?.filename || ref.filename,+ attachment,+ });+ }++ for (const attachment of selectStandaloneAttachments(content, attachments)) {+ if (!isImageAttachment(attachment.content_type, attachment.filename)) {+ continue;+ }+ push({+ key: attachment.id,+ url:+ attachment.download_url || attachment.markdown_url || attachment.url,+ filename: attachment.filename,+ attachment,+ });+ }+ }++ return items;+}++/** Index of `key` in the sequence, or -1 when it is not part of it. */+export function indexOfImageKey(+ items: ReadonlyArray<ImageSequenceItem>,+ key: string,+): number {+ if (!key) return -1;+ return items.findIndex((item) => item.key === key);+}diff --git a/packages/core/attachments/index.ts b/packages/core/attachments/index.tsnew file mode 100644index 0000000000..ef2f05ee99--- /dev/null+++ b/packages/core/attachments/index.ts@@ -0,0 +1,9 @@+export {+ collectImageSequence,+ indexOfImageKey,+ isImageAttachment,+ matchAttachmentByURL,+ selectStandaloneAttachments,+ type ImageSequenceBlock,+ type ImageSequenceItem,+} from "./image-sequence";diff --git a/packages/core/package.json b/packages/core/package.jsonindex feb3280b27..2a9fcfdad3 100644--- a/packages/core/package.json+++ b/packages/core/package.json@@ -13,6 +13,8 @@"./markdown": "./markdown/index.ts","./types": "./types/index.ts","./types/*": "./types/*.ts",+ "./attachments": "./attachments/index.ts",+ "./attachments/image-sequence": "./attachments/image-sequence.ts","./api": "./api/index.ts","./api/client": "./api/client.ts","./api/schema": "./api/schema.ts",diff --git a/packages/views/chat/components/chat-message-list.tsx b/packages/views/chat/components/chat-message-list.tsxindex c1dae6be41..ea382bc6dc 100644--- a/packages/views/chat/components/chat-message-list.tsx+++ b/packages/views/chat/components/chat-message-list.tsx@@ -33,6 +33,8 @@ import { RichContent } from "../../rich-content";import { RichContentScrollRootProvider } from "../../rich-content/scroll-root";import { copyText } from "@multica/ui/lib/clipboard";import { AttachmentList } from "../../issues/components/comment-card";+import { ImageSequenceProvider } from "../../editor";+import { collectImageSequence } from "@multica/core/attachments/image-sequence";import type { AgentAvailability } from "@multica/core/agents";import { resolveFailureReasonKey } from "@multica/core/agents";import type {@@ -252,7 +254,27 @@ export function ChatMessageList({availability,};+ // Every image in this session, in message order, so opening one lets the+ // reader page through the rest (MUL-5752). Built from the message data, not+ // from what Virtuoso currently has mounted.+ //+ // Persisted messages only: a task transcript's own attachments live behind a+ // separate query and its blocks are collapsed by default, so an image in+ // there keeps its standalone preview instead of entering a sequence the+ // reader can't see the rest of.+ const imageSequence = useMemo(+ () =>+ collectImageSequence(+ messages.map((message) => ({+ content: message.content,+ attachments: message.attachments,+ })),+ ),+ [messages],+ );+return (+ <ImageSequenceProvider items={imageSequence}><divref={setScrollContainerRef}data-tab-scroll-root@@ -318,6 +340,7 @@ export function ChatMessageList({</RichContentScrollRootProvider>)}</div>+ </ImageSequenceProvider>);}diff --git a/packages/views/editor/attachment-download-context.tsx b/packages/views/editor/attachment-download-context.tsxindex 2d50c5ce98..13b2236da9 100644--- a/packages/views/editor/attachment-download-context.tsx+++ b/packages/views/editor/attachment-download-context.tsx@@ -2,7 +2,7 @@import { createContext, use, useMemo, type ReactNode } from "react";import type { Attachment } from "@multica/core/types";-import { attachmentIdFromDownloadURL } from "@multica/core/types/attachment-url";+import { matchAttachmentByURL } from "@multica/core/attachments/image-sequence";import { openExternal } from "../platform";import { useDownloadAttachment } from "./use-download-attachment";@@ -28,18 +28,6 @@ interface ProviderProps {children: ReactNode;}-function stripQueryAndFragment(url: string): string {- return url.split(/[?#]/, 1)[0] ?? "";-}--function matchesAttachmentURL(embeddedURL: string, attachmentURL?: string): boolean {- if (!embeddedURL || !attachmentURL) return false;- if (embeddedURL === attachmentURL) return true;- const embeddedStable = stripQueryAndFragment(embeddedURL);- const attachmentStable = stripQueryAndFragment(attachmentURL);- return embeddedStable !== "" && embeddedStable === attachmentStable;-}-/*** Provides a click-time download handler to Tiptap NodeViews mounted inside* `ContentEditor`. Without a provider the consumer falls back to opening the@@ -57,28 +45,10 @@ export function AttachmentDownloadProvider({ attachments, children }: ProviderPrconst download = useDownloadAttachment();const value = useMemo<ResolvedDownload>(() => {- const lookup = (url: string): Attachment | undefined => {- if (!url || !attachments?.length) return undefined;- // Preferred path: stable `/api/attachments/<id>/download` URL.- // Match by id so the lookup survives a host swap (Electron vs- // web vs SSR) and any incidental query/fragment.- const idFromUrl = attachmentIdFromDownloadURL(url);- if (idFromUrl) {- const byId = attachments.find((a) => a.id === idFromUrl);- if (byId) return byId;- }- // Legacy path: full URL equality. Covers comments persisted- // before MUL-3130, S3/CloudFront markdown that points- // straight at the CDN, and anything else where- // `attachments[i].url` was the literal value embedded in- // markdown.- return attachments.find(- (a) =>- matchesAttachmentURL(url, a.url) ||- matchesAttachmentURL(url, a.download_url) ||- matchesAttachmentURL(url, a.markdown_url),- );- };+ // Shared with the gallery sequence builder (MUL-5752) so a markdown URL+ // can never resolve to one record here and a different one there.+ const lookup = (url: string): Attachment | undefined =>+ matchAttachmentByURL(url, attachments);return {resolveAttachmentId: (url) => lookup(url)?.id,resolveAttachment: lookup,diff --git a/packages/views/editor/attachment-preview-modal.tsx b/packages/views/editor/attachment-preview-modal.tsxindex de2be0eda0..3dad5f4602 100644--- a/packages/views/editor/attachment-preview-modal.tsx+++ b/packages/views/editor/attachment-preview-modal.tsx@@ -36,6 +36,7 @@ import {useCallback,useEffect,useMemo,+ useRef,useState,type ReactNode,} from "react";@@ -45,7 +46,15 @@ import {PreviewTooLargeError,PreviewUnsupportedError,} from "@multica/core/api";-import { Download, ExternalLink, FileText, Loader2, X } from "lucide-react";+import {+ ChevronLeft,+ ChevronRight,+ Download,+ ExternalLink,+ FileText,+ Loader2,+ X,+} from "lucide-react";import type { Attachment } from "@multica/core/types";import { paths, useWorkspaceSlug } from "@multica/core/paths";import { cn } from "@multica/ui/lib/utils";@@ -65,6 +74,7 @@ import {} from "./utils/preview";import { useDownloadAttachment } from "./use-download-attachment";import { useAttachmentHtmlText } from "./hooks/use-attachment-html-text";+import { useResignedInlineMediaURL } from "./hooks/use-inline-media-url";import { useZoomCanvas, type ZoomCanvasApi } from "./hooks/use-zoom-canvas";import { ZoomCanvas, ZoomControls } from "./zoom-canvas";import type { Size } from "./utils/zoom-transform";@@ -138,10 +148,29 @@ function normalize(source: PreviewSource): PreviewState {// Public props// ---------------------------------------------------------------------------+/**+ * Position of this preview inside a surface's image sequence (MUL-5752).+ *+ * `onPrev` / `onNext` are undefined AT the boundaries — the sequence does not+ * wrap, so first/last simply disable the corresponding control. Supplied only+ * by `ImageSequenceProvider`; a standalone preview leaves this unset and+ * renders exactly as before.+ */+export interface PreviewSequence {+ /** 0-based. Rendered as `index + 1` of `total`. */+ index: number;+ total: number;+ onPrev?: () => void;+ onNext?: () => void;+}+interface AttachmentPreviewModalProps {source: PreviewSource;open: boolean;onClose: () => void;+ sequence?: PreviewSequence;+ /** Fired when the image kind fails to load — lets a gallery skip the frame. */+ onImageError?: () => void;}// ---------------------------------------------------------------------------@@ -206,6 +235,80 @@ export function useAttachmentPreview(): AttachmentPreviewHandle {return useMemo(() => ({ open, tryOpen, modal }), [open, tryOpen, modal]);}+// ---------------------------------------------------------------------------+// Image swap without a blank frame+// ---------------------------------------------------------------------------++// Returns the last image URL that finished decoding, holding the previous one+// on screen while the next downloads. Swapping `<img src>` (or remounting the+// panel) the moment navigation happens blanks the canvas for the full+// network+decode gap; decode-then-swap is the standard lightbox fix.+//+// On load failure the hook reports the error and keeps the last good frame —+// when the whole remaining sequence is broken the reader stays on the last+// image that worked (with the "unavailable" toast) instead of a broken glyph.+//+// Engines without `Image.decode()` (jsdom in tests) swap immediately: the old+// pre-MUL-5752 behaviour, traded back for correctness there.+function useSettledImageURL(+ targetUrl: string,+ enabled: boolean,+ onLoadError?: () => void,+): string {+ const [settled, setSettled] = useState(targetUrl);+ const onErrorRef = useRef(onLoadError);+ onErrorRef.current = onLoadError;++ useEffect(() => {+ if (!enabled) return;+ if (!targetUrl) {+ setSettled(targetUrl);+ return;+ }+ let cancelled = false;+ const probe = new window.Image();+ if (typeof probe.decode !== "function") {+ setSettled(targetUrl);+ return;+ }+ probe.src = targetUrl;+ probe.decode().then(+ () => {+ if (!cancelled) setSettled(targetUrl);+ },+ () => {+ // Rejection covers both load failure and undecodable bytes.+ if (!cancelled) onErrorRef.current?.();+ },+ );+ return () => {+ cancelled = true;+ };+ }, [targetUrl, enabled]);++ return enabled ? settled : targetUrl;+}++// Warms the browser cache for a sequence neighbour so paging to it swaps+// without a visible wait: runs the same URL re-sign the panel itself would,+// then fetches the bytes through a detached <img>. Renders nothing.+export function PreviewImagePrefetch({ source }: { source: PreviewSource }) {+ const state = normalize(source);+ const url = useResignedInlineMediaURL(+ state.attachmentId ?? undefined,+ state.mediaUrl,+ true,+ );++ useEffect(() => {+ if (!url) return;+ const probe = new window.Image();+ probe.src = url;+ }, [url]);++ return null;+}+// ---------------------------------------------------------------------------// Modal — frame + dispatch// ---------------------------------------------------------------------------@@ -215,6 +318,8 @@ export function AttachmentPreviewModal({open,onClose,onExitComplete,+ sequence,+ onImageError,}: AttachmentPreviewModalProps & { onExitComplete?: () => void }) {const download = useDownloadAttachment();const shouldReduceMotion = useReducedMotion() ?? false;@@ -224,14 +329,32 @@ export function AttachmentPreviewModal({const slug = useWorkspaceSlug();const navigation = useNavigation();+ const onPrev = sequence?.onPrev;+ const onNext = sequence?.onNext;+useEffect(() => {if (!open) return;const handler = (e: KeyboardEvent) => {- if (e.key === "Escape") onClose();+ if (e.key === "Escape") {+ onClose();+ return;+ }+ // Arrow navigation only when this preview is part of a sequence. The+ // zoom canvas gives its horizontal arrows up in that case (see+ // `horizontalArrowPan` below), so exactly one of the two responds.+ // Modified presses stay with the browser / OS.+ if (e.metaKey || e.ctrlKey || e.altKey || e.shiftKey) return;+ if (e.key === "ArrowLeft" && onPrev) {+ e.preventDefault();+ onPrev();+ } else if (e.key === "ArrowRight" && onNext) {+ e.preventDefault();+ onNext();+ }};document.addEventListener("keydown", handler);return () => document.removeEventListener("keydown", handler);- }, [open, onClose]);+ }, [open, onClose, onPrev, onNext]);const kind = getPreviewKind(state.contentType, state.filename);@@ -329,7 +452,15 @@ export function AttachmentPreviewModal({>{/* Below the `open &&` gate on purpose: the panel's zoom state isdestroyed on close, so every open re-fits instead of restoring- a stale zoom from the last time this image was viewed. */}+ a stale zoom from the last time this image was viewed.++ Deliberately NOT keyed on the file: remounting the panel on+ sequence navigation blanks the canvas for the whole+ network+decode gap. The panel persists and swaps the image+ only once the next one has decoded (`useSettledImageURL`).+ Zoom still resets per image — `natural` passes through null on+ every swap, so the canvas re-fits even across a run of+ same-resolution screenshots. */}<PreviewPanelkind={kind}source={source}@@ -337,6 +468,8 @@ export function AttachmentPreviewModal({onClose={onClose}onDownload={handleDownload}onOpenInNewTab={canOpenInNewTab ? handleOpenInNewTab : undefined}+ sequence={sequence}+ onImageError={onImageError}/></motion.div></motion.div>@@ -360,6 +493,8 @@ function PreviewPanel({onClose,onDownload,onOpenInNewTab,+ sequence,+ onImageError,}: {kind: PreviewKind | null;source: PreviewSource;@@ -367,9 +502,25 @@ function PreviewPanel({onClose: () => void;onDownload: () => void;onOpenInNewTab?: () => void;+ sequence?: PreviewSequence;+ onImageError?: () => void;}) {const { t } = useT("editor");+ // Gallery navigation hands this panel an attachment the reader never+ // clicked, so — unlike the click-through path, where <Attachment> had+ // already upgraded the URL — the modal has to run the re-sign itself. A+ // no-op for URLs that are already loadable (signed CDN, public storage).+ const targetUrl = useResignedInlineMediaURL(+ state.attachmentId ?? undefined,+ state.mediaUrl,+ kind === "image",+ );+ // The previous image stays on the canvas until this one has decoded — the+ // swap itself is what used to flash. Also absorbs the re-sign URL upgrade+ // (raw -> signed) without a second visible load.+ const mediaUrl = useSettledImageURL(targetUrl, kind === "image", onImageError);+// Natural size is carried with the URL it was measured from, so a panel// reused for a different attachment can never fit the new image against the// old one's dimensions.@@ -377,8 +528,14 @@ function PreviewPanel({null,);const natural =- kind === "image" && measured?.url === state.mediaUrl ? measured.size : null;- const canvas = useZoomCanvas({ content: natural });+ kind === "image" && measured?.url === mediaUrl ? measured.size : null;+ // Left / right arrows belong to the sequence when there is one; the canvas+ // keeps them for panning otherwise. Vertical arrows always pan, and a+ // zoomed image still pans horizontally by drag / wheel.+ const canvas = useZoomCanvas({+ content: natural,+ horizontalArrowPan: !sequence,+ });const handleNaturalSize = useCallback((url: string, size: Size) => {@@ -397,14 +554,26 @@ function PreviewPanel({<><div className="flex items-center gap-2 border-b border-border bg-muted/30 px-4 py-2"><FileText className="size-4 shrink-0 text-muted-foreground" />- <p className="truncate text-body font-medium">{state.filename}</p>- <span className="ml-1 shrink-0 text-caption text-muted-foreground">- {state.contentType || "—"}- </span>+ {/* Baseline group: filename (text-body) and type (text-caption) are+ different type sizes on one line — the row's items-center would+ center their unequal line boxes and visibly offset the smaller+ text. Mixed-size text aligns by baseline. */}+ <div className="flex min-w-0 items-baseline gap-2">+ <p className="truncate text-body font-medium">{state.filename}</p>+ <span className="shrink-0 text-caption text-muted-foreground">+ {state.contentType || "—"}+ </span>+ </div><div className="ml-auto flex items-center gap-1">- {/* Only once the image has been measured: without a natural size- there is no canvas behind these buttons to drive. */}- {natural && <ZoomControls canvas={canvas} className="mr-1" />}+ {/* Standalone preview keeps the original gate — no controls until+ the image is measured, and none at all for content that has no+ intrinsic size to drive. In a sequence they stay mounted+ (disabled while un-measured) instead: `natural` passes through+ null on every swap, and controls that vanish and reappear shift+ the buttons to their right on every navigation. */}+ {kind === "image" && (natural || sequence) && (+ <ZoomControls canvas={canvas} disabled={!natural} />+ )}{onOpenInNewTab && (<buttontype="button"@@ -445,16 +614,18 @@ function PreviewPanel({instead of scrolling. */}<divclassName={cn(- "min-h-0 flex-1 bg-background",+ "relative min-h-0 flex-1 bg-background",kind === "image" ? "flex flex-col overflow-hidden" : "overflow-auto",)}>{kind === "image" ? (<ImagePreviewstate={state}+ mediaUrl={mediaUrl}canvas={canvas}natural={natural}onNaturalSize={handleNaturalSize}+ onError={onImageError}/>) : (<PreviewContent@@ -464,28 +635,99 @@ function PreviewPanel({onDownload={onDownload}/>)}+ {sequence && (+ <>+ <SequenceButton+ side="prev"+ label={t(($) => $.image.previous)}+ onClick={sequence.onPrev}+ />+ <SequenceButton+ side="next"+ label={t(($) => $.image.next)}+ onClick={sequence.onNext}+ />+ {/* Position lives with the navigation it describes, not in the+ header's action cluster — same bottom-counter shape as the+ mobile lightbox. */}+ <span+ className="pointer-events-none absolute bottom-3 left-1/2 z-10 -translate-x-1/2 select-none rounded-full bg-background/80 px-2.5 py-1 text-caption tabular-nums text-foreground shadow-sm backdrop-blur-sm"+ aria-live="polite"+ >+ {t(($) => $.image.sequence_position, {+ index: sequence.index + 1,+ total: sequence.total,+ })}+ </span>+ </>+ )}</div></>);}+// ---------------------------------------------------------------------------+// Sequence controls+// ---------------------------------------------------------------------------++// Edge-anchored chevrons, the shape every image viewer uses. `onClick`+// undefined means "boundary reached": the button stays mounted but disabled,+// so the reader can see they are at one end instead of the control vanishing+// and shifting nothing into its place.+function SequenceButton({+ side,+ label,+ onClick,+}: {+ side: "prev" | "next";+ label: string;+ onClick?: () => void;+}) {+ const Icon = side === "prev" ? ChevronLeft : ChevronRight;+ return (+ <button+ type="button"+ className={cn(+ "absolute top-1/2 z-10 -translate-y-1/2 rounded-full bg-background/80 p-2 text-foreground shadow-sm backdrop-blur-sm transition-opacity",+ // No disabled:pointer-events-none (the shadcn default): this button+ // floats over the zoom canvas, and letting a disabled boundary arrow+ // pass pointer events through would show the canvas's grab cursor —+ // "draggable here" — exactly where the UI means "nothing to click".+ // The disabled attribute already blocks activation.+ "enabled:hover:bg-background disabled:opacity-30",+ side === "prev" ? "left-3" : "right-3",+ )}+ title={label}+ aria-label={label}+ disabled={!onClick}+ onClick={onClick}+ >+ <Icon className="size-5" />+ </button>+ );+}+// ---------------------------------------------------------------------------// Image — zoom canvas// ---------------------------------------------------------------------------function ImagePreview({state,+ mediaUrl,canvas,natural,onNaturalSize,+ onError,}: {state: PreviewState;+ mediaUrl: string;canvas: ZoomCanvasApi;natural: Size | null;onNaturalSize: (url: string, size: Size) => void;+ onError?: () => void;}) {const { t } = useT("editor");- const url = state.mediaUrl;+ const url = mediaUrl;const readNaturalSize = useCallback((image: HTMLImageElement | null) => {@@ -515,6 +757,7 @@ function ImagePreview({// so that event never fires — measure from the ref as well.ref={readNaturalSize}onLoad={(e) => readNaturalSize(e.currentTarget)}+ onError={onError}src={url}alt={state.filename}className={cn(diff --git a/packages/views/editor/attachment.tsx b/packages/views/editor/attachment.tsxindex b43ccb1a0e..6c995977cb 100644--- a/packages/views/editor/attachment.tsx+++ b/packages/views/editor/attachment.tsx@@ -23,7 +23,6 @@* hints (selected, editable, onDelete).*/-import { useEffect, useState } from "react";import {Download,Link as LinkIcon,@@ -33,14 +32,17 @@ import {import { toast } from "sonner";import { cn } from "@multica/ui/lib/utils";import { copyText } from "@multica/ui/lib/clipboard";-import { useQuery } from "@tanstack/react-query";import { api } from "@multica/core/api";import { useConfigStore } from "@multica/core/config";import type { Attachment as AttachmentRecord } from "@multica/core/types";-import { attachmentIdFromDownloadURL } from "@multica/core/types/attachment-url";import { useT } from "../i18n";import { useAttachmentDownloadResolver } from "./attachment-download-context";import { useAttachmentPreview } from "./attachment-preview-modal";+import { useImageSequencePreview } from "./image-sequence-context";+import {+ isObjectURL,+ useResignedInlineMediaURL,+} from "./hooks/use-inline-media-url";import { useDownloadAttachment } from "./use-download-attachment";import { AttachmentCard } from "./attachment-card";import { HtmlAttachmentPreview } from "./html-attachment-preview";@@ -305,137 +307,6 @@ function hasExpiringSignatureQuery(q: URLSearchParams): boolean {return false;}-// ----------------------------------------------------------------------------// Inline media re-sign (MUL-3254)-// -----------------------------------------------------------------------------// Keep refetches well inside the server's signed-URL TTL (30 min default,-// server/internal/handler/file.go) so a re-render never serves an expired-// signature from the query cache.-const RESIGN_STALE_MS = 20 * 60 * 1000;--// How long fetched image bytes stay in the query cache after the last <img>-// using them unmounts. The bytes themselves never go stale (an attachment id-// maps to an immutable storage object), so the blob query uses-// `staleTime: Infinity`; this bound exists purely to keep a long scroll-// through an image-heavy thread from pinning every decoded screenshot in-// renderer memory forever.-const INLINE_BLOB_GC_MS = 5 * 60 * 1000;--// useResignedInlineMediaURL upgrades an auth-gated media URL to a freshly-// signed one for clients that cannot load `/api/attachments/<id>/download`-// natively.-//-// The picked inline URL can end up being the stable per-attachment API-// endpoint (e.g. a reopened issue draft, whose persisted record deliberately-// strips the short-lived signed `download_url`). That endpoint needs-// credentials: web loads it because the session cookie rides on the <img>-// request when it is genuinely same-origin. Desktop's file:// renderer, the-// mobile webview, and split-origin web deployments cannot rely on that: no-// cookie is attached and the Bearer token cannot be put on a native resource-// fetch, so the image 401s. Desktop/mobile expose a non-empty-// `api.getBaseUrl()`; web can also hit this path when the server emits an-// absolute markdown URL whose origin differs from the current page.-//-// For them, fetch fresh attachment metadata through the authenticated API —-// the same re-sign the click-time download path already does — and swap in-// the response's signed `download_url`.-//-// The server only has a signed URL to offer under CloudFront signing or-// presign mode. In **proxy** download mode `GetAttachmentByID` hands back the-// auth-gated API path again, and before MUL-5445 the renderer simply kept the-// original URL — the image stayed broken and the metadata request was pure-// overhead. Proxy is not an exotic setting: the default `auto` mode forces it-// whenever the storage URL points at an internal host, which is exactly the-// docker-compose MinIO (`http://minio:9000`) self-host shape. So when the-// refreshed metadata confirms there is no signed URL, fall back to pulling the-// bytes through the authenticated client and rendering them from an object-// URL. `blobFallback` gates that on the caller actually rendering a native-// `<img>`: a file card only needs a link, and downloading a 100 MB archive-// into renderer memory to draw a chip would be a bad trade.-function useResignedInlineMediaURL(- attachmentId: string | undefined,- pickedUrl: string,- blobFallback: boolean,-): string {- const idFromPickedUrl = attachmentIdFromDownloadURL(pickedUrl);- const resignAttachmentId = attachmentId ?? idFromPickedUrl;- const isCrossOriginWebURL = (() => {- if (!/^https?:\/\//i.test(pickedUrl) || typeof window === "undefined") {- return false;- }- try {- return new URL(pickedUrl).origin !== window.location.origin;- } catch {- return false;- }- })();- const needsResign =- !!resignAttachmentId &&- !!pickedUrl &&- idFromPickedUrl !== undefined &&- ((api.getBaseUrl?.() ?? "") !== "" || isCrossOriginWebURL);-- const { data: fresh } = useQuery({- queryKey: ["attachment-inline-resign", resignAttachmentId],- queryFn: () => api.getAttachment(resignAttachmentId as string),- enabled: needsResign,- staleTime: RESIGN_STALE_MS,- gcTime: RESIGN_STALE_MS,- });-- const dl = fresh?.download_url ?? "";- // Accept the fresh URL only when it is an actual upgrade — absolute and no- // longer the auth-gated API shape (i.e. a signed storage URL the renderer- // can load natively).- const signedUrl =- /^https?:\/\//i.test(dl) && attachmentIdFromDownloadURL(dl) === undefined- ? dl- : "";-- // Only after `fresh` has landed do we know this deployment has nothing- // signed to give — firing the byte fetch earlier would double-download on- // every CloudFront / presign client.- const { data: blob } = useQuery({- queryKey: ["attachment-inline-blob", resignAttachmentId],- queryFn: () => api.getAttachmentBlob(resignAttachmentId as string),- enabled: needsResign && blobFallback && !!fresh && signedUrl === "",- staleTime: Infinity,- gcTime: INLINE_BLOB_GC_MS,- });- const blobUrl = useObjectURL(blob);-- if (!needsResign) return pickedUrl;- if (signedUrl) return signedUrl;- return blobUrl || pickedUrl;-}--// useObjectURL turns a Blob into a `blob:` URL for the lifetime of the calling-// component, revoking it on unmount / replacement so the bytes are released-// once nothing renders them. Returns "" while there is no blob (and during-// SSR, where createObjectURL does not exist).-function useObjectURL(blob: Blob | undefined): string {- const [url, setUrl] = useState("");- useEffect(() => {- if (!blob || typeof URL.createObjectURL !== "function") {- setUrl("");- return;- }- const next = URL.createObjectURL(blob);- setUrl(next);- return () => {- URL.revokeObjectURL(next);- };- }, [blob]);- return url;-}--// isObjectURL flags a src that only resolves inside this renderer session —-// safe to paint, wrong to expose through Copy Link or persist anywhere.-function isObjectURL(rawUrl: string): boolean {- return /^blob:/i.test(rawUrl);-}-// ---------------------------------------------------------------------------// Dispatcher// ---------------------------------------------------------------------------@@ -452,6 +323,7 @@ export function Attachment({const cdnSigned = useConfigStore((s) => s.cdnSigned);const download = useDownloadAttachment();const preview = useAttachmentPreview();+ const sequence = useImageSequencePreview();const state = normalize(attachment, resolveAttachment, cdnDomain, cdnSigned);const forceKind =@@ -476,7 +348,18 @@ export function Attachment({// to another surface keeps the durable pick instead.const shareUrl = isObjectURL(mediaUrl) ? state.url : mediaUrl;+ // Identity this image has in the surrounding surface's sequence: the+ // attachment id once the URL resolves to a record, otherwise the URL exactly+ // as written in the body — the same pair `collectImageSequence` keys on.+ const sequenceKey =+ state.attachmentId ?? (attachment.kind === "url" ? attachment.url : "");+const openPreview = () => {+ // Inside an issue / chat, an image opens the surface's shared viewer at+ // its real position so the reader can page through the rest. Anything the+ // sequence doesn't know — a composer's in-flight upload, a surface with no+ // provider — falls through to the single-image preview below.+ if (kind === "image" && sequence.openAt(sequenceKey)) return;if (state.record) {preview.tryOpen({kind: "full",diff --git a/packages/views/editor/hooks/use-inline-media-url.ts b/packages/views/editor/hooks/use-inline-media-url.tsnew file mode 100644index 0000000000..f5f1a0a1cd--- /dev/null+++ b/packages/views/editor/hooks/use-inline-media-url.ts@@ -0,0 +1,142 @@+"use client";++/**+ * Inline media re-sign (MUL-3254).+ *+ * Extracted from editor/attachment.tsx so the preview modal can run the same+ * upgrade: gallery navigation (MUL-5752) hands the modal an attachment the+ * user never clicked, so the modal can no longer rely on the inline renderer+ * having already resolved a loadable URL for it.+ */++import { useEffect, useState } from "react";+import { useQuery } from "@tanstack/react-query";+import { api } from "@multica/core/api";+import { attachmentIdFromDownloadURL } from "@multica/core/types/attachment-url";++// Keep refetches well inside the server's signed-URL TTL (30 min default,+// server/internal/handler/file.go) so a re-render never serves an expired+// signature from the query cache.+const RESIGN_STALE_MS = 20 * 60 * 1000;++// How long fetched image bytes stay in the query cache after the last <img>+// using them unmounts. The bytes themselves never go stale (an attachment id+// maps to an immutable storage object), so the blob query uses+// `staleTime: Infinity`; this bound exists purely to keep a long scroll+// through an image-heavy thread from pinning every decoded screenshot in+// renderer memory forever.+const INLINE_BLOB_GC_MS = 5 * 60 * 1000;++// useResignedInlineMediaURL upgrades an auth-gated media URL to a freshly+// signed one for clients that cannot load `/api/attachments/<id>/download`+// natively.+//+// The picked inline URL can end up being the stable per-attachment API+// endpoint (e.g. a reopened issue draft, whose persisted record deliberately+// strips the short-lived signed `download_url`). That endpoint needs+// credentials: web loads it because the session cookie rides on the <img>+// request when it is genuinely same-origin. Desktop's file:// renderer, the+// mobile webview, and split-origin web deployments cannot rely on that: no+// cookie is attached and the Bearer token cannot be put on a native resource+// fetch, so the image 401s. Desktop/mobile expose a non-empty+// `api.getBaseUrl()`; web can also hit this path when the server emits an+// absolute markdown URL whose origin differs from the current page.+//+// For them, fetch fresh attachment metadata through the authenticated API —+// the same re-sign the click-time download path already does — and swap in+// the response's signed `download_url`.+//+// The server only has a signed URL to offer under CloudFront signing or+// presign mode. In **proxy** download mode `GetAttachmentByID` hands back the+// auth-gated API path again, and before MUL-5445 the renderer simply kept the+// original URL — the image stayed broken and the metadata request was pure+// overhead. Proxy is not an exotic setting: the default `auto` mode forces it+// whenever the storage URL points at an internal host, which is exactly the+// docker-compose MinIO (`http://minio:9000`) self-host shape. So when the+// refreshed metadata confirms there is no signed URL, fall back to pulling the+// bytes through the authenticated client and rendering them from an object+// URL. `blobFallback` gates that on the caller actually rendering a native+// `<img>`: a file card only needs a link, and downloading a 100 MB archive+// into renderer memory to draw a chip would be a bad trade.+export function useResignedInlineMediaURL(+ attachmentId: string | undefined,+ pickedUrl: string,+ blobFallback: boolean,+): string {+ const idFromPickedUrl = attachmentIdFromDownloadURL(pickedUrl);+ const resignAttachmentId = attachmentId ?? idFromPickedUrl;+ const isCrossOriginWebURL = (() => {+ if (!/^https?:\/\//i.test(pickedUrl) || typeof window === "undefined") {+ return false;+ }+ try {+ return new URL(pickedUrl).origin !== window.location.origin;+ } catch {+ return false;+ }+ })();+ const needsResign =+ !!resignAttachmentId &&+ !!pickedUrl &&+ idFromPickedUrl !== undefined &&+ ((api.getBaseUrl?.() ?? "") !== "" || isCrossOriginWebURL);++ const { data: fresh } = useQuery({+ queryKey: ["attachment-inline-resign", resignAttachmentId],+ queryFn: () => api.getAttachment(resignAttachmentId as string),+ enabled: needsResign,+ staleTime: RESIGN_STALE_MS,+ gcTime: RESIGN_STALE_MS,+ });++ const dl = fresh?.download_url ?? "";+ // Accept the fresh URL only when it is an actual upgrade — absolute and no+ // longer the auth-gated API shape (i.e. a signed storage URL the renderer+ // can load natively).+ const signedUrl =+ /^https?:\/\//i.test(dl) && attachmentIdFromDownloadURL(dl) === undefined+ ? dl+ : "";++ // Only after `fresh` has landed do we know this deployment has nothing+ // signed to give — firing the byte fetch earlier would double-download on+ // every CloudFront / presign client.+ const { data: blob } = useQuery({+ queryKey: ["attachment-inline-blob", resignAttachmentId],+ queryFn: () => api.getAttachmentBlob(resignAttachmentId as string),+ enabled: needsResign && blobFallback && !!fresh && signedUrl === "",+ staleTime: Infinity,+ gcTime: INLINE_BLOB_GC_MS,+ });+ const blobUrl = useObjectURL(blob);++ if (!needsResign) return pickedUrl;+ if (signedUrl) return signedUrl;+ return blobUrl || pickedUrl;+}++// useObjectURL turns a Blob into a `blob:` URL for the lifetime of the calling+// component, revoking it on unmount / replacement so the bytes are released+// once nothing renders them. Returns "" while there is no blob (and during+// SSR, where createObjectURL does not exist).+function useObjectURL(blob: Blob | undefined): string {+ const [url, setUrl] = useState("");+ useEffect(() => {+ if (!blob || typeof URL.createObjectURL !== "function") {+ setUrl("");+ return;+ }+ const next = URL.createObjectURL(blob);+ setUrl(next);+ return () => {+ URL.revokeObjectURL(next);+ };+ }, [blob]);+ return url;+}++// isObjectURL flags a src that only resolves inside this renderer session —+// safe to paint, wrong to expose through Copy Link or persist anywhere.+export function isObjectURL(rawUrl: string): boolean {+ return /^blob:/i.test(rawUrl);+}diff --git a/packages/views/editor/hooks/use-zoom-canvas.ts b/packages/views/editor/hooks/use-zoom-canvas.tsindex dabaf6cf7d..ee6c8b054f 100644--- a/packages/views/editor/hooks/use-zoom-canvas.ts+++ b/packages/views/editor/hooks/use-zoom-canvas.ts@@ -47,6 +47,13 @@ import {interface UseZoomCanvasOptions {/** Natural (unscaled) size of the content, or null while it is unknown. */content: Size | null;+ /**+ * Whether Left/Right pan the canvas. Set false when the surrounding viewer+ * binds those keys itself — image-sequence prev/next (MUL-5752) — so the two+ * handlers can't both fire on one press. Up/Down keep panning either way,+ * and drag / wheel still pan horizontally.+ */+ horizontalArrowPan?: boolean;}export interface ZoomCanvasApi {@@ -89,7 +96,10 @@ function nearlyEqual(a: number, b: number): boolean {return Math.abs(a - b) < 0.5;}-export function useZoomCanvas({ content }: UseZoomCanvasOptions): ZoomCanvasApi {+export function useZoomCanvas({+ content,+ horizontalArrowPan = true,+}: UseZoomCanvasOptions): ZoomCanvasApi {const [viewportNode, setViewportNode] = useState<HTMLDivElement | null>(null);const [viewport, setViewport] = useState<Size>(EMPTY_SIZE);const [transform, setTransform] = useState<ZoomTransform>(IDENTITY);@@ -345,6 +355,10 @@ export function useZoomCanvas({ content }: UseZoomCanvasOptions): ZoomCanvasApireturn;case "ArrowLeft":case "ArrowRight":+ // Left to the viewer (image sequence prev/next) when it owns them.+ // No preventDefault, so the event keeps bubbling to its handler.+ if (!horizontalArrowPan) return;+ // fallthroughcase "ArrowUp":case "ArrowDown": {event.preventDefault();@@ -360,7 +374,7 @@ export function useZoomCanvas({ content }: UseZoomCanvasOptions): ZoomCanvasApidefault:}},- [zoomIn, zoomOut, fit],+ [zoomIn, zoomOut, fit, horizontalArrowPan],);// Double-click toggles fit <-> 100%, anchored under the cursor on the way in.diff --git a/packages/views/editor/image-sequence-context.test.tsx b/packages/views/editor/image-sequence-context.test.tsxnew file mode 100644index 0000000000..f39b185620--- /dev/null+++ b/packages/views/editor/image-sequence-context.test.tsx@@ -0,0 +1,347 @@+import { beforeEach, describe, expect, it, vi } from "vitest";+import {+ act,+ fireEvent,+ render as rtlRender,+ screen,+} from "@testing-library/react";+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";+import { useState, type ReactElement } from "react";+import type { Attachment } from "@multica/core/types";+import { collectImageSequence } from "@multica/core/attachments/image-sequence";++const { downloadMock, getBaseUrlMock, toastErrorMock } = vi.hoisted(() => ({+ downloadMock: vi.fn(),+ getBaseUrlMock: vi.fn(() => ""),+ toastErrorMock: vi.fn(),+}));++vi.mock("../platform", () => ({ openExternal: vi.fn() }));++vi.mock("@multica/core/api", () => ({+ api: { getBaseUrl: getBaseUrlMock, getAttachmentTextContent: vi.fn() },+ PreviewTooLargeError: class extends Error {},+ PreviewUnsupportedError: class extends Error {},+}));++vi.mock("./use-download-attachment", () => ({+ useDownloadAttachment: () => downloadMock,+}));++vi.mock("../navigation", () => ({+ useNavigation: () => ({+ push: vi.fn(),+ replace: vi.fn(),+ back: vi.fn(),+ pathname: "/acme/issues",+ searchParams: new URLSearchParams(),+ getShareableUrl: (p: string) => `https://app.example${p}`,+ }),+}));++vi.mock("./readonly-content", () => ({+ ReadonlyContent: () => null,+}));++vi.mock("sonner", () => ({ toast: { error: toastErrorMock } }));++const STRINGS: Record<string, Record<string, string>> = {+ image: {+ download: "Download",+ canvas_label: "Image canvas",+ previous: "Previous image",+ next: "Next image",+ sequence_position: "{{index}} / {{total}}",+ unavailable: "That image is no longer available — skipped it.",+ },+ canvas: {+ zoom_in: "Zoom in",+ zoom_out: "Zoom out",+ zoom_fit: "Fit to view",+ zoom_actual: "Actual size",+ },+ attachment: {+ close: "Close",+ preview_unsupported: "This file type can't be previewed.",+ open_in_new_tab: "Open in new tab",+ },+};++vi.mock("../i18n", () => ({+ useT: () => ({+ t: (+ sel: (s: Record<string, Record<string, string>>) => string,+ params?: Record<string, string | number>,+ ) => {+ const raw = sel(STRINGS);+ if (!params) return raw;+ return raw.replace(/\{\{(\w+)\}\}/g, (_, k: string) => String(params[k]));+ },+ }),+}));++import {+ ImageSequenceProvider,+ useImageSequencePreview,+} from "./image-sequence-context";++function render(ui: ReactElement) {+ const qc = new QueryClient({+ defaultOptions: { queries: { retry: false, gcTime: 0 } },+ });+ return rtlRender(<QueryClientProvider client={qc}>{ui}</QueryClientProvider>);+}++const UUID = (n: number) =>+ `${String(n).repeat(8)}-${String(n).repeat(4)}-4${String(n).repeat(3)}-8${String(n).repeat(3)}-${String(n).repeat(12)}`;++function imageAttachment(n: number): Attachment {+ const id = UUID(n);+ return {+ id,+ workspace_id: "ws-1",+ issue_id: null,+ comment_id: null,+ chat_session_id: null,+ chat_message_id: null,+ uploader_type: "member",+ uploader_id: "u-1",+ filename: `shot-${n}.png`,+ url: `https://cdn.example.test/${id}.png`,+ download_url: `https://cdn.example.test/${id}.png?Signature=s`,+ markdown_url: `https://cdn.example.test/${id}.png`,+ content_type: "image/png",+ size_bytes: 10,+ created_at: "2026-08-05T00:00:00Z",+ };+}++const THREE = [imageAttachment(1), imageAttachment(2), imageAttachment(3)];++// Each attachment lands in its own block, mirroring three comments each+// carrying one screenshot.+function sequenceOf(attachments: Attachment[]) {+ return collectImageSequence(attachments.map((a) => ({ attachments: [a] })));+}++function Opener({ openKey }: { openKey: string }) {+ const sequence = useImageSequencePreview();+ return (+ <button type="button" onClick={() => sequence.openAt(openKey)}>+ open+ </button>+ );+}++// The "X / Y" readout is the only place the modal prints a bare count.+function expectCounter(text: string) {+ expect(screen.getByText(text)).toBeInTheDocument();+}++function prevButton(): HTMLButtonElement {+ return screen.getByRole("button", { name: "Previous image" });+}+function nextButton(): HTMLButtonElement {+ return screen.getByRole("button", { name: "Next image" });+}++beforeEach(() => {+ vi.clearAllMocks();+});++describe("ImageSequenceProvider", () => {+ it("opens at the clicked image's real position and reports X / Y", () => {+ render(+ <ImageSequenceProvider items={sequenceOf(THREE)}>+ <Opener openKey={THREE[1]!.id} />+ </ImageSequenceProvider>,+ );++ act(() => {+ fireEvent.click(screen.getByText("open"));+ });++ expectCounter("2 / 3");+ expect(screen.getByRole("dialog")).toHaveAttribute(+ "aria-label",+ "shot-2.png",+ );+ });++ it("walks forward and back without wrapping, disabling at each end", () => {+ render(+ <ImageSequenceProvider items={sequenceOf(THREE)}>+ <Opener openKey={THREE[0]!.id} />+ </ImageSequenceProvider>,+ );+ act(() => {+ fireEvent.click(screen.getByText("open"));+ });++ // First image: no previous.+ expectCounter("1 / 3");+ expect(prevButton()).toBeDisabled();+ expect(nextButton()).not.toBeDisabled();++ act(() => {+ fireEvent.click(nextButton());+ });+ expectCounter("2 / 3");+ expect(prevButton()).not.toBeDisabled();++ act(() => {+ fireEvent.click(nextButton());+ });+ // Last image: no next, and clicking it cannot wrap to the first.+ expectCounter("3 / 3");+ expect(nextButton()).toBeDisabled();++ act(() => {+ fireEvent.click(prevButton());+ });+ expectCounter("2 / 3");+ });++ it("moves with the left / right arrow keys", () => {+ render(+ <ImageSequenceProvider items={sequenceOf(THREE)}>+ <Opener openKey={THREE[0]!.id} />+ </ImageSequenceProvider>,+ );+ act(() => {+ fireEvent.click(screen.getByText("open"));+ });++ act(() => {+ fireEvent.keyDown(document, { key: "ArrowRight" });+ });+ expectCounter("2 / 3");++ act(() => {+ fireEvent.keyDown(document, { key: "ArrowLeft" });+ });+ expectCounter("1 / 3");++ // At the first image ArrowLeft is inert rather than wrapping.+ act(() => {+ fireEvent.keyDown(document, { key: "ArrowLeft" });+ });+ expectCounter("1 / 3");+ });++ it("freezes the sequence at open time so later images can't shift the index", () => {+ function Harness() {+ const [items, setItems] = useState(sequenceOf(THREE));+ return (+ <ImageSequenceProvider items={items}>+ <Opener openKey={THREE[2]!.id} />+ <button+ type="button"+ onClick={() =>+ setItems(sequenceOf([imageAttachment(9), ...THREE]))+ }+ >+ grow+ </button>+ </ImageSequenceProvider>+ );+ }+ render(<Harness />);++ act(() => {+ fireEvent.click(screen.getByText("open"));+ });+ expectCounter("3 / 3");++ // A comment lands while the preview is open.+ act(() => {+ fireEvent.click(screen.getByText("grow"));+ });+ expectCounter("3 / 3");+ });++ it("skips a broken image and says so", () => {+ render(+ <ImageSequenceProvider items={sequenceOf(THREE)}>+ <Opener openKey={THREE[0]!.id} />+ </ImageSequenceProvider>,+ );+ act(() => {+ fireEvent.click(screen.getByText("open"));+ });+ act(() => {+ fireEvent.click(nextButton());+ });+ expectCounter("2 / 3");++ act(() => {+ fireEvent.error(screen.getByRole("dialog").querySelector("img")!);+ });++ // Kept moving the way the reader was going, and the dead frame is now out+ // of the walk in both directions.+ expectCounter("3 / 3");+ expect(toastErrorMock).toHaveBeenCalledTimes(1);+ act(() => {+ fireEvent.click(prevButton());+ });+ expectCounter("1 / 3");+ });++ it("reports false for an image the surface does not know", () => {+ const seen: boolean[] = [];+ function Probe() {+ const sequence = useImageSequencePreview();+ return (+ <button+ type="button"+ onClick={() => seen.push(sequence.openAt("https://cdn/unknown.png"))}+ >+ try+ </button>+ );+ }+ render(+ <ImageSequenceProvider items={sequenceOf(THREE)}>+ <Probe />+ </ImageSequenceProvider>,+ );+ act(() => {+ fireEvent.click(screen.getByText("try"));+ });+ expect(seen).toEqual([false]);+ expect(screen.queryByRole("dialog")).toBeNull();+ });++ it("leaves a lone image with no sequence chrome", () => {+ render(+ <ImageSequenceProvider items={sequenceOf([THREE[0]!])}>+ <Opener openKey={THREE[0]!.id} />+ </ImageSequenceProvider>,+ );+ act(() => {+ fireEvent.click(screen.getByText("open"));+ });+ expect(screen.getByRole("dialog")).toBeInTheDocument();+ expect(screen.queryByRole("button", { name: "Next image" })).toBeNull();+ });+});++describe("useImageSequencePreview without a provider", () => {+ it("reports false so the caller can fall back to a single preview", () => {+ const seen: boolean[] = [];+ function Probe() {+ const sequence = useImageSequencePreview();+ return (+ <button type="button" onClick={() => seen.push(sequence.openAt("k"))}>+ try+ </button>+ );+ }+ render(<Probe />);+ act(() => {+ fireEvent.click(screen.getByText("try"));+ });+ expect(seen).toEqual([false]);+ });+});diff --git a/packages/views/editor/image-sequence-context.tsx b/packages/views/editor/image-sequence-context.tsxnew file mode 100644index 0000000000..ee7a6ebb54--- /dev/null+++ b/packages/views/editor/image-sequence-context.tsx@@ -0,0 +1,219 @@+"use client";++/**+ * ImageSequenceProvider — prev / next for the images of ONE surface (MUL-5752).+ *+ * A surface that can hold several images (an issue: description + every+ * comment; a chat session: every message) mounts this once with the ordered+ * sequence built by `collectImageSequence`. Clicking any image inside opens+ * the shared preview modal at that image's real position and lets the reader+ * page through the rest.+ *+ * Why one provider instead of per-image state: `<Attachment>` owns a private+ * `useAttachmentPreview()` modal, which is right for a lone image but cannot+ * know what comes next. The provider hosts a single modal above every image,+ * so navigation state has exactly one owner.+ *+ * Two behaviours worth stating up front, both from the product brief:+ *+ * - The sequence is FROZEN when the modal opens. New comments and streaming+ * agent output keep arriving while a preview is open; recomputing live+ * would shift "3 / 7" under the reader mid-look.+ * - Boundaries DISABLE, they don't wrap. First image: no previous. Last+ * image: no next.+ *+ * Images outside the sequence (an in-flight upload in a composer, an image in+ * a surface with no provider) are not an error: `openAt` reports false and the+ * caller falls back to its own single-image preview.+ */++import {+ createContext,+ use,+ useCallback,+ useMemo,+ useRef,+ useState,+ type ReactNode,+} from "react";+import { toast } from "sonner";+import {+ indexOfImageKey,+ type ImageSequenceItem,+} from "@multica/core/attachments/image-sequence";+import { useT } from "../i18n";+import {+ AttachmentPreviewModal,+ PreviewImagePrefetch,+ type PreviewSource,+} from "./attachment-preview-modal";++interface ImageSequenceApi {+ /**+ * Open the shared viewer at `key` — the attachment id, or the URL as written+ * in the body for references that don't resolve to a record.+ *+ * Returns false when no provider is mounted or the key is not part of this+ * surface's sequence, so callers can fall back to a single-image preview.+ */+ openAt: (key: string) => boolean;+}++const NO_SEQUENCE: ImageSequenceApi = { openAt: () => false };++const ImageSequenceContext = createContext<ImageSequenceApi>(NO_SEQUENCE);++/**+ * Returns the surrounding surface's image viewer, or a no-op handle when+ * there is no provider. Always safe to call — `openAt` reporting false is the+ * documented "not part of a sequence" answer, not a failure.+ */+export function useImageSequencePreview(): ImageSequenceApi {+ return use(ImageSequenceContext);+}++function toPreviewSource(item: ImageSequenceItem): PreviewSource {+ return item.attachment+ ? { kind: "full", attachment: item.attachment }+ : { kind: "url", url: item.url, filename: item.filename };+}++interface Session {+ /** Snapshot taken at open time — see the freeze note in the file header. */+ items: ImageSequenceItem[];+ index: number;+}++export function ImageSequenceProvider({+ items,+ children,+}: {+ items: ReadonlyArray<ImageSequenceItem>;+ children: ReactNode;+}) {+ const { t } = useT("editor");+ // Read at click time only, so a streaming surface doesn't re-create the+ // context value (and re-render every image) on every incoming message.+ const itemsRef = useRef(items);+ itemsRef.current = items;++ const [session, setSession] = useState<Session | null>(null);+ const [open, setOpen] = useState(false);+ // Images that failed to load this session. Kept out of navigation so a+ // deleted attachment can't trap the reader on a broken frame, and so the+ // auto-skip below can't bounce between two dead images forever. The ref is+ // the synchronous truth (an <img> can report failure more than once before+ // React re-renders); the state copy exists to drive that re-render.+ const brokenRef = useRef<Set<string>>(new Set());+ const [broken, setBroken] = useState<ReadonlySet<string>>(brokenRef.current);+ // Direction of the last move, so a load failure keeps skipping the way the+ // reader was already going.+ const directionRef = useRef<1 | -1>(1);++ const api = useMemo<ImageSequenceApi>(+ () => ({+ openAt: (key: string) => {+ const snapshot = [...itemsRef.current];+ const index = indexOfImageKey(snapshot, key);+ if (index < 0) return false;+ directionRef.current = 1;+ brokenRef.current = new Set();+ setBroken(brokenRef.current);+ setSession({ items: snapshot, index });+ setOpen(true);+ return true;+ },+ }),+ [],+ );++ const step = useCallback(+ (current: Session, from: number, delta: 1 | -1, skip: ReadonlySet<string>) => {+ for (let i = from + delta; i >= 0 && i < current.items.length; i += delta) {+ if (!skip.has(current.items[i]!.key)) return i;+ }+ return -1;+ },+ [],+ );++ const go = useCallback(+ (delta: 1 | -1) => {+ if (!session) return;+ const next = step(session, session.index, delta, brokenRef.current);+ if (next < 0) return;+ directionRef.current = delta;+ setSession({ ...session, index: next });+ },+ [session, step],+ );++ // A frame that fails to decode is skipped rather than left on screen: the+ // attachment was deleted, or its signed URL outlived the session. Advance+ // the way the reader was heading, then the other way, and only give up (and+ // leave the broken frame visible) when nothing loadable is left.+ const handleImageError = useCallback(() => {+ if (!session) return;+ const failed = session.items[session.index];+ if (!failed || brokenRef.current.has(failed.key)) return;++ brokenRef.current = new Set(brokenRef.current).add(failed.key);+ setBroken(brokenRef.current);+ toast.error(t(($) => $.image.unavailable));++ const forward = directionRef.current;+ const next = step(session, session.index, forward, brokenRef.current);+ const target =+ next >= 0+ ? next+ : step(session, session.index, forward === 1 ? -1 : 1, brokenRef.current);+ if (target >= 0) setSession({ ...session, index: target });+ }, [session, step, t]);++ const current = session ? session.items[session.index] : undefined;+ const prevIndex = session ? step(session, session.index, -1, broken) : -1;+ const nextIndex = session ? step(session, session.index, 1, broken) : -1;++ const modal =+ session && current ? (+ <AttachmentPreviewModal+ source={toPreviewSource(current)}+ open={open}+ onClose={() => setOpen(false)}+ onExitComplete={() => setSession(null)}+ onImageError={handleImageError}+ sequence={+ session.items.length > 1+ ? {+ index: session.index,+ total: session.items.length,+ onPrev: prevIndex >= 0 ? () => go(-1) : undefined,+ onNext: nextIndex >= 0 ? () => go(1) : undefined,+ }+ : undefined+ }+ />+ ) : null;++ return (+ <ImageSequenceContext.Provider value={api}>+ {children}+ {modal}+ {/* Warm the immediate neighbours while a preview is open, so paging+ swaps from cache instead of waiting a network round-trip. Keyed+ mounts: moving re-targets the prefetch to the new neighbours. */}+ {open && session && prevIndex >= 0 && (+ <PreviewImagePrefetch+ key={session.items[prevIndex]!.key}+ source={toPreviewSource(session.items[prevIndex]!)}+ />+ )}+ {open && session && nextIndex >= 0 && (+ <PreviewImagePrefetch+ key={session.items[nextIndex]!.key}+ source={toPreviewSource(session.items[nextIndex]!)}+ />+ )}+ </ImageSequenceContext.Provider>+ );+}diff --git a/packages/views/editor/index.ts b/packages/views/editor/index.tsindex c17edca2f0..bc912837ee 100644--- a/packages/views/editor/index.ts+++ b/packages/views/editor/index.ts@@ -28,7 +28,14 @@ export {useAttachmentPreview,isPreviewable,} from "./attachment-preview-modal";-export type { AttachmentPreviewHandle } from "./attachment-preview-modal";+export type {+ AttachmentPreviewHandle,+ PreviewSequence,+} from "./attachment-preview-modal";+export {+ ImageSequenceProvider,+ useImageSequencePreview,+} from "./image-sequence-context";export { AttachmentCard } from "./attachment-card";export type { AttachmentCardProps } from "./attachment-card";export { Attachment } from "./attachment";diff --git a/packages/views/editor/utils/preview.ts b/packages/views/editor/utils/preview.tsindex 95a2c8f313..e43720e5ee 100644--- a/packages/views/editor/utils/preview.ts+++ b/packages/views/editor/utils/preview.ts@@ -10,6 +10,8 @@* (CloudFront, no auth on the client side) or a new authenticated proxy.*/+import { isImageAttachment } from "@multica/core/attachments/image-sequence";+export type PreviewKind =| "image"| "pdf"@@ -134,9 +136,9 @@ const VIDEO_EXTS = new Set<string>([const AUDIO_EXTS = new Set<string>(["mp3", "wav", "m4a", "ogg", "oga", "flac", "aac", "opus",]);-const IMAGE_EXTS = new Set<string>([- "png", "jpg", "jpeg", "gif", "webp", "avif", "bmp", "ico", "svg",-]);+// Image detection lives in @multica/core/attachments/image-sequence — the+// gallery sequence builder needs the same answer and is shared with mobile,+// which cannot import from packages/views.function extOf(filename: string): string {const base = filename.toLowerCase().split(/[\\/]/).pop() ?? "";@@ -182,7 +184,7 @@ export function getPreviewKind(// Image — must come BEFORE the html/text branches because svg is// text-like (XML), and image/* content-types include text/svg variants// that isTextLike would otherwise catch.- if (ct.startsWith("image/") || (ext && IMAGE_EXTS.has(ext))) return "image";+ if (isImageAttachment(contentType, filename)) return "image";// Markdown — covers both the well-typed case and the common// server-side sniffer fallback (text/plain for .md).diff --git a/packages/views/issues/components/comment-card.tsx b/packages/views/issues/components/comment-card.tsxindex ecae8686e0..6006f211ed 100644--- a/packages/views/issues/components/comment-card.tsx+++ b/packages/views/issues/components/comment-card.tsx@@ -38,6 +38,7 @@ import { CommentTriggerChips } from "./comment-trigger-chips";import { useCommentTriggerPreview } from "../hooks/use-comment-trigger-preview";import type { TimelineEntry, Attachment } from "@multica/core/types";import { contentReferencesAttachment } from "@multica/core/types";+import { selectStandaloneAttachments } from "@multica/core/attachments/image-sequence";import { useCommentCollapseStore, useCommentDraftStore } from "@multica/core/issues/stores";import { useT } from "../../i18n";import { CommentsFoldBar } from "./resolved-thread-bar";@@ -182,28 +183,11 @@ export function AttachmentList({onRemove?: (attachmentId: string) => void;}) {if (!attachments?.length) return null;- // Skip attachments whose URL (stable or legacy) is already referenced- // in the markdown content, and duplicates of the same file (same- // name/type/size) that are referenced. The dual-shape match is the- // MUL-3130 follow-through — a comment can mix the new- // /api/attachments/<id>/download URL and the legacy att.url shape.- const standalone = content- ? attachments.filter((a) => {- if (contentReferencesAttachment(content, a)) return false;- // Dedup: if another attachment with the same file identity is already- // inline in the content, this is a duplicate upload — skip it.- const hasSiblingInContent = attachments.some(- (other) =>- other.id !== a.id &&- other.filename === a.filename &&- other.content_type === a.content_type &&- other.size_bytes === a.size_bytes &&- contentReferencesAttachment(content, other),- );- if (hasSiblingInContent) return false;- return true;- })- : attachments;+ // Skip attachments whose URL (stable or legacy) is already referenced in the+ // markdown content, and duplicates of the same file that are referenced.+ // Shared with the image-sequence builder (MUL-5752) so the cards rendered+ // here and the images the viewer pages through can't disagree.+ const standalone = selectStandaloneAttachments(content, attachments);if (!standalone.length) return null;return (diff --git a/packages/views/issues/components/issue-detail.test.tsx b/packages/views/issues/components/issue-detail.test.tsxindex 12e709e292..75acc135a9 100644--- a/packages/views/issues/components/issue-detail.test.tsx+++ b/packages/views/issues/components/issue-detail.test.tsx@@ -158,6 +158,11 @@ vi.mock("../../editor", async () => ({tryOpen: () => false,modal: null,}),+ // Pass-through: the detail page wraps its column in the image-sequence+ // provider, but paging between images is covered in+ // image-sequence-context.test.tsx against the real provider.+ ImageSequenceProvider: ({ children }: { children: React.ReactNode }) =>+ children,isPreviewable: () => false,ReadonlyContent: ({ content }: { content: string }) => (<div data-testid="readonly-content">{content}</div>diff --git a/packages/views/issues/components/issue-detail.tsx b/packages/views/issues/components/issue-detail.tsxindex 07d85561da..61412ff6ed 100644--- a/packages/views/issues/components/issue-detail.tsx+++ b/packages/views/issues/components/issue-detail.tsx@@ -30,7 +30,8 @@ import { Button } from "@multica/ui/components/ui/button";import { ResizablePanelGroup, ResizablePanel, ResizableHandle } from "@multica/ui/components/ui/resizable";import { Sheet, SheetContent } from "@multica/ui/components/ui/sheet";import { useIsMobile } from "@multica/ui/hooks/use-mobile";-import { ContentEditor, type ContentEditorRef, TitleEditor, type TitleEditorRef, useFileDropZone, FileDropOverlay, useLazyEditor, useEditorUpload } from "../../editor";+import { ContentEditor, type ContentEditorRef, TitleEditor, type TitleEditorRef, useFileDropZone, FileDropOverlay, useLazyEditor, useEditorUpload, ImageSequenceProvider } from "../../editor";+import { collectImageSequence, type ImageSequenceBlock } from "@multica/core/attachments/image-sequence";import { FileUploadButton } from "@multica/ui/components/common/file-upload-button";import {Tooltip,@@ -1716,9 +1717,44 @@ export function IssueDetail({ issueId, onDelete, onDone, defaultSidebarOpen = tr// so text/code attachments show an Eye before the bind round-trips.const [descPendingAttachments, setDescPendingAttachments] = useState<Attachment[]>([]);const descPendingAttachmentsRef = useRef<Attachment[]>([]);- const descEditorAttachments = descPendingAttachments.length > 0- ? [...(issueAttachments ?? []), ...descPendingAttachments]- : issueAttachments;+ // Memoized because the image sequence below keys off this array: without it+ // the concat branch hands a fresh reference to every render and rebuilds the+ // whole issue's sequence on each one.+ const descEditorAttachments = useMemo(+ () =>+ descPendingAttachments.length > 0+ ? [...(issueAttachments ?? []), ...descPendingAttachments]+ : issueAttachments,+ [issueAttachments, descPendingAttachments],+ );++ // Every image in this issue, in the order the page renders them: the+ // description first, then each timeline comment with its thread replies+ // nested under it (MUL-5752). Built from `items` rather than the flat+ // timeline so a reply sits next to the root it renders under, and from data+ // rather than the DOM because Virtuoso only mounts the visible window.+ //+ // A resolved thread that is currently collapsed still contributes its+ // images: they belong to the issue and are one click from being on screen,+ // so leaving them out would make the counter change depending on which+ // threads happen to be folded.+ const imageSequence = useMemo(() => {+ const blocks: ImageSequenceBlock[] = [+ { content: issue?.description, attachments: descEditorAttachments },+ ];+ for (const item of items) {+ if (item.kind === "activity-group") continue;+ blocks.push({+ content: item.entry.content,+ attachments: item.entry.attachments,+ });+ for (const reply of timelineView.threadReplies.get(item.entry.id) ?? []) {+ blocks.push({ content: reply.content, attachments: reply.attachments });+ }+ }+ return collectImageSequence(blocks);+ }, [issue?.description, descEditorAttachments, items, timelineView.threadReplies]);+const handleDescriptionUpload = useCallback(async (file: File) => {const result = await uploadWithToast(file);@@ -2323,6 +2359,10 @@ export function IssueDetail({ issueId, onDelete, onDone, defaultSidebarOpen = tr: [];const detailContent = (+ // Hosts the one image viewer this issue's images page through — see+ // ImageSequenceProvider. Wraps the whole column so the description+ // editor's images and the timeline's images share one sequence.+ <ImageSequenceProvider items={imageSequence}><div className="relative flex h-full min-w-0 flex-1 flex-col">{/* In-page find bar — floats over the top-right of the content column(below the breadcrumb header), outside the scroll container so it@@ -2943,6 +2983,7 @@ export function IssueDetail({ issueId, onDelete, onDone, defaultSidebarOpen = tr/>)}</div>+ </ImageSequenceProvider>);if (isMobile) {diff --git a/packages/views/locales/en/editor.json b/packages/views/locales/en/editor.jsonindex 81bb022e32..0646a7221f 100644--- a/packages/views/locales/en/editor.json+++ b/packages/views/locales/en/editor.json@@ -35,7 +35,11 @@"delete": "Delete","link_copied": "Link copied","copy_link_failed": "Failed to copy link",- "canvas_label": "Image canvas. Drag to pan, scroll to zoom, double-click to toggle actual size."+ "canvas_label": "Image canvas. Drag to pan, scroll to zoom, double-click to toggle actual size.",+ "previous": "Previous image",+ "next": "Next image",+ "sequence_position": "{{index}} / {{total}}",+ "unavailable": "That image is no longer available — skipped it."},"canvas": {"zoom_in": "Zoom in",diff --git a/packages/views/locales/ja/editor.json b/packages/views/locales/ja/editor.jsonindex cd16888dc8..b91d72713d 100644--- a/packages/views/locales/ja/editor.json+++ b/packages/views/locales/ja/editor.json@@ -35,7 +35,11 @@"delete": "削除","link_copied": "リンクをコピーしました","copy_link_failed": "リンクをコピーできませんでした",- "canvas_label": "画像キャンバス。ドラッグで移動、スクロールで拡大縮小、ダブルクリックで実際のサイズに切り替えできます。"+ "canvas_label": "画像キャンバス。ドラッグで移動、スクロールで拡大縮小、ダブルクリックで実際のサイズに切り替えできます。",+ "previous": "前の画像",+ "next": "次の画像",+ "sequence_position": "{{index}} / {{total}}",+ "unavailable": "この画像は表示できないためスキップしました。"},"canvas": {"zoom_in": "拡大",diff --git a/packages/views/locales/ko/editor.json b/packages/views/locales/ko/editor.jsonindex 77230f871b..2c7ce3dcdc 100644--- a/packages/views/locales/ko/editor.json+++ b/packages/views/locales/ko/editor.json@@ -35,7 +35,11 @@"delete": "삭제","link_copied": "링크를 복사했습니다","copy_link_failed": "링크를 복사하지 못했습니다",- "canvas_label": "이미지 캔버스. 드래그하여 이동, 스크롤하여 확대/축소, 두 번 클릭하여 실제 크기로 전환할 수 있습니다."+ "canvas_label": "이미지 캔버스. 드래그하여 이동, 스크롤하여 확대/축소, 두 번 클릭하여 실제 크기로 전환할 수 있습니다.",+ "previous": "이전 이미지",+ "next": "다음 이미지",+ "sequence_position": "{{index}} / {{total}}",+ "unavailable": "이 이미지를 불러올 수 없어 건너뛰었습니다."},"canvas": {"zoom_in": "확대",diff --git a/packages/views/locales/zh-Hans/editor.json b/packages/views/locales/zh-Hans/editor.jsonindex a38198b7a7..1b82bf0559 100644--- a/packages/views/locales/zh-Hans/editor.json+++ b/packages/views/locales/zh-Hans/editor.json@@ -35,7 +35,11 @@"delete": "删除","link_copied": "已复制链接","copy_link_failed": "复制链接失败",- "canvas_label": "图片画布,拖动可平移,滚动可缩放,双击可切换实际大小。"+ "canvas_label": "图片画布,拖动可平移,滚动可缩放,双击可切换实际大小。",+ "previous": "上一张",+ "next": "下一张",+ "sequence_position": "第 {{index}} / {{total}} 张",+ "unavailable": "这张图片已失效,已跳过。"},"canvas": {"zoom_in": "放大",