The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 11:00 UTC
fix(mobile): inline markdown images page through their message's images (#37117)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Nov 15, 2026 at 01:08 UTC
45649628dcb7d07cf6b91d94f94d327037a2967f
2 files changed
+19
-4
apps/mobile/src/features/threads/ThreadFeed.tsx
+18
-4
@@ -1092,7 +1092,11 @@ interface MarkdownLinkHandlers {
1092
actionId: string,
1093
reply?: MarkdownLinkReply,
1094
) => void;
1095
- readonly onImagePress?: (href: string) => void;
1095
+ /** `withGallery` pages the image through its message's images; the feed's viewer sits outside that scope. */
1096
+ readonly onImagePress?: (
1097
+ href: string,
1098
+ withGallery?: (source: FilePreviewSource) => FilePreviewSource,
1099
+ ) => void;
1100
readonly resolveImageSource?: MarkdownImageSourceResolver;
1101
readonly fileEmbedLabel?: (href: string, standalone: boolean) => string | null;
1102
readonly linkCustomization?: (href: string) => MarkdownLinkCustomization | undefined;
@@ -1174,8 +1178,11 @@ const AssistantMarkdownContent = memo(function AssistantMarkdownContent(props: {
1178
const models = useModelMentions(props.environmentId, props.markdown);
1179
const liveMarkdown = useLiveThreadLinkLabels(props.markdown, props.environmentId);
1180
const threadIcons = useThreadChipIcons(props.environmentId, liveMarkdown);
1181
+ const withGallery = useFilePreviewGallery();
1182
+ const onImagePress = props.linkHandlers.onImagePress;
1183
const linkHandlers: MarkdownLinkHandlers = {
1184
...props.linkHandlers,
1185
+ ...(onImagePress ? { onImagePress: (href: string) => onImagePress(href, withGallery) } : {}),
1186
onLinkPress: (href) => props.linkHandlers.onLinkPress(href, props.reply),
1187
onFileContextMenuAction: (href, actionId) =>
1188
props.linkHandlers.onFileContextMenuAction(href, actionId, props.reply),
@@ -3009,7 +3016,12 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
3016
};
3017
return lookup().catch(() => relativePath);
3018
};
3012
- const onMarkdownLinkPress = (href: string, imageEmbed = false, reply?: MarkdownLinkReply) => {
3019
+ const onMarkdownLinkPress = (
3020
+ href: string,
3021
+ imageEmbed = false,
3022
+ reply?: MarkdownLinkReply,
3023
+ withGallery?: (source: FilePreviewSource) => FilePreviewSource,
3024
+ ) => {
3025
markdownLinkRequest.current?.abort();
3026
const request = new AbortController();
3027
markdownLinkRequest.current = request;
@@ -3042,7 +3054,9 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
3054
if (request.signal.aborted) return;
3055
openPreview(
3056
scope,
3045
- media.kind === "video" ? { video: media.source } : { file: media.source },
3057
+ media.kind === "video"
3058
+ ? { video: media.source }
3059
+ : { file: withGallery ? withGallery(media.source) : media.source },
3060
);
3061
};
3062
const resource = "resource" in media.source ? media.source.resource : null;
@@ -3117,7 +3131,7 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
3131
),
3132
onLinkPress: (href, reply) => onMarkdownLinkPress(href, false, reply),
3133
linkCustomization: enrichedThreadLinkCustomization,
3120
- onImagePress: (href) => onMarkdownLinkPress(href, true),
3134
+ onImagePress: (href, withGallery) => onMarkdownLinkPress(href, true, undefined, withGallery),
3135
resolveImageSource,
3136
fileContextMenu: (href) => {
3137
const skill = enrichedSkillReference(href, props.skills);
apps/mobile/src/lib/filePreview.test.ts
+1
@@ -241,6 +241,7 @@ vi.mock("../components/ui/Menu", () => ({
241
}));
242
vi.mock("../components/ui/FilePreviewGallery", () => ({
243
FilePreviewGallery: ({ children }: { children?: ReactNode }) => children,
244
+ useFilePreviewGallery: () => (source: unknown) => source,
245
}));
246
vi.mock("../components/ui/FilePreviewModal", () => ({
247
FilePreviewModal: (props: { source: { name: string } | null }) =>