Skip to content
Source
Sign inSign up
pingdotgg/t3code

Fix inline Markdown image previews in chat #4785

ClosedAculnaj(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/4785/headopened View on GitHub

Showing 5 changed files with 44 additions and 0 deletions (loading 3).

x
0 of 5 viewed, 5 left
43 additions and 0 deletionsapps/web/src/components/chat/MessagesTimeline.test.tsxModified
View file
@@ -222,7 +222,50 @@
​
+function buildAssistantTimelineEntry(text: string) {
+ return {
+ id: "entry-assistant",
+ kind: "message" as const,
+ createdAt: MESSAGE_CREATED_AT,
+ message: {
+ id: MessageId.make("message-assistant"),
+ role: "assistant" as const,
+ text,
+ turnId: null,
+ createdAt: MESSAGE_CREATED_AT,
+ updatedAt: MESSAGE_CREATED_AT,
+ streaming: false,
+ },
+ };
+}
+​
describe("MessagesTimeline", () => {
+ it("keeps linked Markdown images under the anchor's interaction", () => {
+ const markup = renderToStaticMarkup(
+ <MessagesTimeline
+ {...buildProps()}
+ timelineEntries={[
+ buildAssistantTimelineEntry(
+ [
+ "[![Linked preview](https://example.com/linked.png)](https://example.com/docs)",