mirror of
https://github.com/getpaseo/paseo.git
synced 2026-07-29 12:01:31 +00:00
fix(app): stop markdown lines joining
Custom line-break rules dropped the resolved full-width break style, allowing adjacent native text spans to collapse onto one line. Preserve the break styles in both chat and shared Markdown renderers.
This commit is contained in:
@@ -569,8 +569,26 @@ export function createSharedMarkdownRules(): RenderRules {
|
|||||||
{children}
|
{children}
|
||||||
</MarkdownInheritedText>
|
</MarkdownInheritedText>
|
||||||
),
|
),
|
||||||
hardbreak: (node: ASTNode) => <MarkdownTextSpan key={node.key}>{"\n"}</MarkdownTextSpan>,
|
hardbreak: (
|
||||||
softbreak: (node: ASTNode) => <MarkdownTextSpan key={node.key}>{"\n"}</MarkdownTextSpan>,
|
node: ASTNode,
|
||||||
|
_children: ReactNode[],
|
||||||
|
_parent: ASTNode[],
|
||||||
|
styles: MarkdownStyles,
|
||||||
|
) => (
|
||||||
|
<MarkdownTextSpan key={node.key} style={styles.hardbreak}>
|
||||||
|
{"\n"}
|
||||||
|
</MarkdownTextSpan>
|
||||||
|
),
|
||||||
|
softbreak: (
|
||||||
|
node: ASTNode,
|
||||||
|
_children: ReactNode[],
|
||||||
|
_parent: ASTNode[],
|
||||||
|
styles: MarkdownStyles,
|
||||||
|
) => (
|
||||||
|
<MarkdownTextSpan key={node.key} style={styles.softbreak}>
|
||||||
|
{"\n"}
|
||||||
|
</MarkdownTextSpan>
|
||||||
|
),
|
||||||
code_block: (
|
code_block: (
|
||||||
node: ASTNode,
|
node: ASTNode,
|
||||||
_children: ReactNode[],
|
_children: ReactNode[],
|
||||||
|
|||||||
@@ -1689,10 +1689,29 @@ export const AssistantMessage = memo(function AssistantMessage({
|
|||||||
// plain <Text> is not hoisted into a UITextViewChild and is dropped (same
|
// plain <Text> is not hoisted into a UITextViewChild and is dropped (same
|
||||||
// root cause as strong/em/s) — so on iOS a hard line break vanished, and
|
// root cause as strong/em/s) — so on iOS a hard line break vanished, and
|
||||||
// a softbreak between words jammed them together ("one\ntwo" -> "onetwo").
|
// a softbreak between words jammed them together ("one\ntwo" -> "onetwo").
|
||||||
// Emit the break through MarkdownTextSpan so it composes on iOS; web and
|
// Emit the break through MarkdownTextSpan so it composes on iOS. Keep
|
||||||
// Android keep the same "\n" they rendered before.
|
// the resolved break styles: hardbreak is a full-width flex-row child on
|
||||||
hardbreak: (node: ASTNode) => <MarkdownTextSpan key={node.key}>{"\n"}</MarkdownTextSpan>,
|
// Android, and dropping that width joins the surrounding text spans.
|
||||||
softbreak: (node: ASTNode) => <MarkdownTextSpan key={node.key}>{"\n"}</MarkdownTextSpan>,
|
hardbreak: (
|
||||||
|
node: ASTNode,
|
||||||
|
_children: ReactNode[],
|
||||||
|
_parent: ASTNode[],
|
||||||
|
styles: MarkdownStyles,
|
||||||
|
) => (
|
||||||
|
<MarkdownTextSpan key={node.key} style={styles.hardbreak}>
|
||||||
|
{"\n"}
|
||||||
|
</MarkdownTextSpan>
|
||||||
|
),
|
||||||
|
softbreak: (
|
||||||
|
node: ASTNode,
|
||||||
|
_children: ReactNode[],
|
||||||
|
_parent: ASTNode[],
|
||||||
|
styles: MarkdownStyles,
|
||||||
|
) => (
|
||||||
|
<MarkdownTextSpan key={node.key} style={styles.softbreak}>
|
||||||
|
{"\n"}
|
||||||
|
</MarkdownTextSpan>
|
||||||
|
),
|
||||||
code_block: (
|
code_block: (
|
||||||
node: ASTNode,
|
node: ASTNode,
|
||||||
_children: ReactNode[],
|
_children: ReactNode[],
|
||||||
|
|||||||
Reference in New Issue
Block a user