From b1be04cb39e27c34f42e029121c896b70ba723c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20G=C3=B3mez?= Date: Wed, 10 Dec 2025 15:47:38 +0100 Subject: [PATCH] feat: fix rtl --- src/components/nostr/RichText/Text.tsx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/components/nostr/RichText/Text.tsx b/src/components/nostr/RichText/Text.tsx index 7eaee5e..52d23bc 100644 --- a/src/components/nostr/RichText/Text.tsx +++ b/src/components/nostr/RichText/Text.tsx @@ -12,24 +12,23 @@ function hasRTLCharacters(text: string): boolean { export function Text({ node }: TextNodeProps) { const text = node.value; - + // If no newlines, render as inline span if (!text.includes("\n")) { const isRTL = hasRTLCharacters(text); return {text || "\u00A0"}; } - - // If has newlines, use spans with
tags + + // If has newlines, use divs for proper RTL per line const lines = text.split("\n"); return ( <> {lines.map((line, idx) => { const isRTL = hasRTLCharacters(line); return ( - - {line || "\u00A0"} - {idx < lines.length - 1 &&
} -
+
+ {line || "\u00A0"} +
); })}