Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(mobile): iPhone chat pictures were empty gray boxes #9087

Closedmichaelmonetized(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/9087/headopened View on GitHub

Showing 5 changed files with 79 additions and 19 deletions (loading 2).

x
0 of 5 viewed, 5 left
64 additions and 15 deletionsapps/mobile/modules/t3-markdown-text/src/NativeMarkdownBlock.ios.tsxModified
View file
@@ -17,6 +17,9 @@
/** Set by SelectableMarkdownText so images anywhere in the block tree can use it. */
export const MarkdownImageRendererContext = createContext<MarkdownImageRenderer | null>(null);
​
+/** Remote/data URIs the fallback Image can load. Workspace paths must go through renderImage. */
+const DIRECT_MARKDOWN_IMAGE_HREF_PATTERN = /^(?:https?:|data:|blob:|\/\/)/i;
+​
type HighlightedCode = ReadonlyArray<ReadonlyArray<MarkdownHighlightedToken>>;
​
const highlightedCodeCache = new Map<string, HighlightedCode>();
@@ -382,8 +385,10 @@
readonly skills: ReadonlyArray<SelectableMarkdownSkill>;
readonly textStyle: NativeMarkdownTextStyle;
readonly onLinkPress?: (href: string) => void;
+ readonly renderImage?: MarkdownImageRenderer | null;
}) {
- const renderImage = useContext(MarkdownImageRendererContext);
+ const contextRenderer = useContext(MarkdownImageRendererContext);
+ const renderImage = props.renderImage ?? contextRenderer;
const href = props.node.href;
if (!href) {
return (
@@ -407,12 +412,57 @@
​
+ const alt = props.node.alt ?? props.node.title;
+ const caption = props.node.alt ? (