Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix: render workspace images in chat markdown #6433

MergedSunkenInTime(GitHub profile, opens in a new tab)merged 9 commits intomain fromrefs/pull/6433/headmerged by maria-rcks View on GitHub

Showing 15 changed files with 57 additions and 34 deletions (loading 12).

x
0 of 15 viewed, 15 left
17 additions and 1 deletionapps/mobile/modules/t3-markdown-text/src/NativeMarkdownBlock.ios.tsxModified
View file
@@ -1,4 +1,4 @@
-import { useEffect, useState } from "react";
+import { createContext, useContext, useEffect, useState } from "react";
import { Image, ScrollView, Text, useColorScheme, View } from "react-native";
import type { MarkdownNode } from "react-native-nitro-markdown/headless";
​
@@ -9,10 +9,14 @@
import type {
MarkdownCodeHighlighter,
MarkdownHighlightedToken,
+ MarkdownImageRenderer,
NativeMarkdownTextStyle,
SelectableMarkdownSkill,
} from "./SelectableMarkdownText.types";
​
+/** Set by SelectableMarkdownText so images anywhere in the block tree can use it. */
+export const MarkdownImageRendererContext = createContext<MarkdownImageRenderer | null>(null);
+​
type HighlightedCode = ReadonlyArray<ReadonlyArray<MarkdownHighlightedToken>>;
​
const highlightedCodeCache = new Map<string, HighlightedCode>();
@@ -379,6 +383,7 @@
readonly textStyle: NativeMarkdownTextStyle;
readonly onLinkPress?: (href: string) => void;
}) {
+ const renderImage = useContext(MarkdownImageRendererContext);
const href = props.node.href;
if (!href) {
return (