@devries-cameron20 / t3code Mirror · read-only / commits / fd51561b4e
Fork 0

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 24, 16:30 UTC

fix(mobile): extend blockquotes across wrapped lines (#6482)

Chris Deeming committed Aug 13, 2026 at 19:00 UTC fd51561b4e2de1893cb7eb4069937256d702572c
4 files changed +79 -8
apps/mobile/modules/t3-markdown-text/src/NativeMarkdownBlock.ios.tsx
+24 -7
@@ -4,16 +4,13 @@ import type { MarkdownNode } from "react-native-nitro-markdown/headless";
4
5 import { CopyTextButton } from "./CopyTextButton";
6 import { MarkdownTextPrimitive } from "./MarkdownTextPrimitive";
7 -import {
8 - nativeMarkdownDocumentRuns,
9 - nativeMarkdownListItemBlocks,
10 - nativeMarkdownTextRuns,
11 -} from "./nativeMarkdownText";
7 +import { nativeMarkdownDocumentRuns, nativeMarkdownListItemBlocks } from "./nativeMarkdownText";
8 import { NativeMarkdownSelectableText } from "./NativeMarkdownSelectableText.ios";
9 import type {
10 MarkdownCodeHighlighter,
11 MarkdownHighlightedToken,
12 NativeMarkdownTextStyle,
13 + SelectableMarkdownSkill,
14 } from "./SelectableMarkdownText.types";
15
16 type HighlightedCode = ReadonlyArray<ReadonlyArray<MarkdownHighlightedToken>>;
@@ -48,12 +45,13 @@ function documentFor(node: MarkdownNode): MarkdownNode {
45
46 function SelectableNode(props: {
47 readonly node: MarkdownNode;
48 + readonly skills: ReadonlyArray<SelectableMarkdownSkill>;
49 readonly textStyle: NativeMarkdownTextStyle;
50 readonly onLinkPress?: (href: string) => void;
51 }) {
52 return (
53 <NativeMarkdownSelectableText
56 - runs={nativeMarkdownDocumentRuns(documentFor(props.node))}
54 + runs={nativeMarkdownDocumentRuns(documentFor(props.node), props.skills)}
55 textStyle={props.textStyle}
56 onLinkPress={props.onLinkPress}
57 />
@@ -322,6 +320,7 @@ function collectTableRows(node: MarkdownNode): MarkdownNode[] {
320
321 function NativeTable(props: {
322 readonly node: MarkdownNode;
323 + readonly skills: ReadonlyArray<SelectableMarkdownSkill>;
324 readonly textStyle: NativeMarkdownTextStyle;
325 readonly onLinkPress?: (href: string) => void;
326 }) {
@@ -359,7 +358,7 @@ function NativeTable(props: {
358 }}
359 >
360 <NativeMarkdownSelectableText
362 - runs={nativeMarkdownTextRuns(cell).map((run) =>
361 + runs={nativeMarkdownDocumentRuns(documentFor(cell), props.skills).map((run) =>
362 rowIndex === 0 || cell.isHeader ? { ...run, bold: true } : run,
363 )}
364 textStyle={props.textStyle}
@@ -376,6 +375,7 @@ function NativeTable(props: {
375
376 function NativeMarkdownImage(props: {
377 readonly node: MarkdownNode;
378 + readonly skills: ReadonlyArray<SelectableMarkdownSkill>;
379 readonly textStyle: NativeMarkdownTextStyle;
380 readonly onLinkPress?: (href: string) => void;
381 }) {
@@ -384,6 +384,7 @@ function NativeMarkdownImage(props: {
384 return (
385 <SelectableNode
386 node={props.node}
387 + skills={props.skills}
388 textStyle={props.textStyle}
389 onLinkPress={props.onLinkPress}
390 />
@@ -445,6 +446,7 @@ function inlineGroups(nodes: ReadonlyArray<MarkdownNode>): MarkdownNode[] {
446
447 function NativeMixedParagraph(props: {
448 readonly node: MarkdownNode;
449 + readonly skills: ReadonlyArray<SelectableMarkdownSkill>;
450 readonly textStyle: NativeMarkdownTextStyle;
451 readonly onLinkPress?: (href: string) => void;
452 }) {
@@ -455,6 +457,7 @@ function NativeMixedParagraph(props: {
457 <NativeMarkdownImage
458 key={nodeKey(child, index)}
459 node={child}
460 + skills={props.skills}
461 textStyle={props.textStyle}
462 onLinkPress={props.onLinkPress}
463 />
@@ -462,6 +465,7 @@ function NativeMixedParagraph(props: {
465 <SelectableNode
466 key={nodeKey(child, index)}
467 node={child}
468 + skills={props.skills}
469 textStyle={props.textStyle}
470 onLinkPress={props.onLinkPress}
471 />
@@ -473,6 +477,7 @@ function NativeMixedParagraph(props: {
477
478 function NativeList(props: {
479 readonly node: MarkdownNode;
480 + readonly skills: ReadonlyArray<SelectableMarkdownSkill>;
481 readonly textStyle: NativeMarkdownTextStyle;
482 readonly highlightCode: MarkdownCodeHighlighter;
483 readonly onLinkPress?: (href: string) => void;
@@ -534,6 +539,7 @@ function NativeList(props: {
539 <NativeMarkdownBlock
540 key={nodeKey(child, childIndex)}
541 node={child}
542 + skills={props.skills}
543 textStyle={props.textStyle}
544 highlightCode={props.highlightCode}
545 onLinkPress={props.onLinkPress}
@@ -551,6 +557,7 @@ function NativeList(props: {
557
558 export function NativeMarkdownBlock(props: {
559 readonly node: MarkdownNode;
560 + readonly skills: ReadonlyArray<SelectableMarkdownSkill>;
561 readonly textStyle: NativeMarkdownTextStyle;
562 readonly highlightCode: MarkdownCodeHighlighter;
563 readonly onLinkPress?: (href: string) => void;
@@ -566,6 +573,7 @@ export function NativeMarkdownBlock(props: {
573 <NativeMarkdownBlock
574 key={nodeKey(child, index)}
575 node={child}
576 + skills={props.skills}
577 textStyle={props.textStyle}
578 highlightCode={props.highlightCode}
579 onLinkPress={props.onLinkPress}
@@ -587,6 +595,7 @@ export function NativeMarkdownBlock(props: {
595 return (
596 <NativeTable
597 node={props.node}
598 + skills={props.skills}
599 textStyle={props.textStyle}
600 onLinkPress={props.onLinkPress}
601 />
@@ -595,6 +604,7 @@ export function NativeMarkdownBlock(props: {
604 return (
605 <NativeMarkdownImage
606 node={props.node}
607 + skills={props.skills}
608 textStyle={props.textStyle}
609 onLinkPress={props.onLinkPress}
610 />
@@ -624,6 +634,7 @@ export function NativeMarkdownBlock(props: {
634 <NativeMarkdownBlock
635 key={nodeKey(child, index)}
636 node={child}
637 + skills={props.skills}
638 textStyle={props.textStyle}
639 highlightCode={props.highlightCode}
640 onLinkPress={props.onLinkPress}
@@ -637,6 +648,7 @@ export function NativeMarkdownBlock(props: {
648 return (
649 <NativeList
650 node={props.node}
651 + skills={props.skills}
652 textStyle={props.textStyle}
653 highlightCode={props.highlightCode}
654 onLinkPress={props.onLinkPress}
@@ -647,12 +659,14 @@ export function NativeMarkdownBlock(props: {
659 return (props.node.children ?? []).some((child) => child.type === "image") ? (
660 <NativeMixedParagraph
661 node={props.node}
662 + skills={props.skills}
663 textStyle={props.textStyle}
664 onLinkPress={props.onLinkPress}
665 />
666 ) : (
667 <SelectableNode
668 node={props.node}
669 + skills={props.skills}
670 textStyle={props.textStyle}
671 onLinkPress={props.onLinkPress}
672 />
@@ -673,6 +687,7 @@ export function NativeMarkdownBlock(props: {
687 >
688 <SelectableNode
689 node={props.node}
690 + skills={props.skills}
691 textStyle={props.textStyle}
692 onLinkPress={props.onLinkPress}
693 />
@@ -690,6 +705,7 @@ export function NativeMarkdownBlock(props: {
705 <NativeMarkdownBlock
706 key={nodeKey(child, index)}
707 node={child}
708 + skills={props.skills}
709 textStyle={props.textStyle}
710 highlightCode={props.highlightCode}
711 onLinkPress={props.onLinkPress}
@@ -703,6 +719,7 @@ export function NativeMarkdownBlock(props: {
719 return (
720 <SelectableNode
721 node={props.node}
722 + skills={props.skills}
723 textStyle={props.textStyle}
724 onLinkPress={props.onLinkPress}
725 />
apps/mobile/modules/t3-markdown-text/src/SelectableMarkdownText.ios.tsx
+1
@@ -69,6 +69,7 @@ export function SelectableMarkdownText({
69 chunk.kind === "rich" ? (
70 <NativeMarkdownBlock
71 node={chunk.node}
72 + skills={skills}
73 textStyle={textStyle}
74 highlightCode={highlightCode}
75 onLinkPress={onLinkPress}
apps/mobile/modules/t3-markdown-text/src/nativeMarkdownText.ts
+1
@@ -661,6 +661,7 @@ function appendDocumentBlock(
661 function containsRichBlock(node: MarkdownNode): boolean {
662 if (
663 node.type === "code_block" ||
664 + node.type === "blockquote" ||
665 node.type === "table" ||
666 node.type === "image" ||
667 node.type === "horizontal_rule" ||
apps/mobile/src/lib/nativeMarkdownText.test.ts
+53 -1
@@ -173,6 +173,25 @@ describe("nativeMarkdownDocumentRuns", () => {
173 ]);
174 });
175
176 + it("decorates known skill references inside blockquotes", () => {
177 + const node: MarkdownNode = {
178 + type: "blockquote",
179 + children: [
180 + {
181 + type: "paragraph",
182 + children: [{ type: "text", content: "Use $ui for this." }],
183 + },
184 + ],
185 + };
186 +
187 + expect(nativeMarkdownDocumentRuns(node, [{ name: "ui", displayName: "UI" }])).toContainEqual({
188 + text: "$ui",
189 + role: "body",
190 + skillName: "ui",
191 + skillLabel: "UI",
192 + });
193 + });
194 +
195 it("leaves unknown skill-like text unchanged", () => {
196 const node: MarkdownNode = {
197 type: "document",
@@ -328,7 +347,7 @@ describe("nativeMarkdownDocumentRuns", () => {
347 ]);
348 });
349
331 - it("includes quotes and fenced code in the same selectable string", () => {
350 + it("preserves quotes and fenced code in document runs", () => {
351 const node: MarkdownNode = {
352 type: "document",
353 children: [
@@ -414,6 +433,39 @@ describe("nativeMarkdownListItemBlocks", () => {
433 });
434
435 describe("nativeMarkdownDocumentChunks", () => {
436 + it("renders plain blockquotes as rich blocks so their marker spans wrapped lines", () => {
437 + const blockquote: MarkdownNode = {
438 + type: "blockquote",
439 + beg: 0,
440 + end: 120,
441 + children: [
442 + {
443 + type: "paragraph",
444 + children: [
445 + {
446 + type: "text",
447 + content:
448 + "Persistent random per-result keys are the strongest design, even when this text wraps.",
449 + },
450 + ],
451 + },
452 + ],
453 + };
454 +
455 + expect(
456 + nativeMarkdownDocumentChunks({
457 + type: "document",
458 + children: [blockquote],
459 + }),
460 + ).toEqual([
461 + {
462 + kind: "rich",
463 + key: "rich:blockquote:0:120",
464 + node: blockquote,
465 + },
466 + ]);
467 + });
468 +
469 it("keeps headings and plain lists in one selectable document", () => {
470 const document: MarkdownNode = {
471 type: "document",