Skip to content

Commit 0ed0611

Browse files
committed
fix(mobile): extend blockquotes across wrapped lines
1 parent 9e20194 commit 0ed0611

2 files changed

Lines changed: 35 additions & 1 deletion

File tree

‎apps/mobile/modules/t3-markdown-text/src/nativeMarkdownText.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,7 @@ function appendDocumentBlock(
661661
function containsRichBlock(node: MarkdownNode): boolean {
662662
if (
663663
node.type === "code_block" ||
664+
node.type === "blockquote" ||
664665
node.type === "table" ||
665666
node.type === "image" ||
666667
node.type === "horizontal_rule" ||

‎apps/mobile/src/lib/nativeMarkdownText.test.ts‎

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ describe("nativeMarkdownDocumentRuns", () => {
328328
]);
329329
});
330330

331-
it("includes quotes and fenced code in the same selectable string", () => {
331+
it("preserves quotes and fenced code in document runs", () => {
332332
const node: MarkdownNode = {
333333
type: "document",
334334
children: [
@@ -414,6 +414,39 @@ describe("nativeMarkdownListItemBlocks", () => {
414414
});
415415

416416
describe("nativeMarkdownDocumentChunks", () => {
417+
it("renders plain blockquotes as rich blocks so their marker spans wrapped lines", () => {
418+
const blockquote: MarkdownNode = {
419+
type: "blockquote",
420+
beg: 0,
421+
end: 120,
422+
children: [
423+
{
424+
type: "paragraph",
425+
children: [
426+
{
427+
type: "text",
428+
content:
429+
"Persistent random per-result keys are the strongest design, even when this text wraps.",
430+
},
431+
],
432+
},
433+
],
434+
};
435+
436+
expect(
437+
nativeMarkdownDocumentChunks({
438+
type: "document",
439+
children: [blockquote],
440+
}),
441+
).toEqual([
442+
{
443+
kind: "rich",
444+
key: "rich:blockquote:0:120",
445+
node: blockquote,
446+
},
447+
]);
448+
});
449+
417450
it("keeps headings and plain lists in one selectable document", () => {
418451
const document: MarkdownNode = {
419452
type: "document",

0 commit comments

Comments
 (0)