Skip to content

Commit 290907f

Browse files
committed
fix: add dir=auto to table cells for proper RTL/LTR text direction
1 parent 56a5e3a commit 290907f

1 file changed

Lines changed: 15 additions & 13 deletions

File tree

src/lib/components/chat/Messages/Markdown/MarkdownTokens.svelte

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,12 @@
142142
>
143143
<tr class="">
144144
{#each token.header as header, headerIdx}
145-
<th
146-
scope="col"
147-
class="px-2.5! py-2! cursor-pointer border-b border-gray-100! dark:border-gray-800!"
148-
style={token.align[headerIdx] ? '' : `text-align: ${token.align[headerIdx]}`}
149-
>
145+
<th
146+
scope="col"
147+
class="px-2.5! py-2! cursor-pointer border-b border-gray-100! dark:border-gray-800!"
148+
style={token.align[headerIdx] ? '' : `text-align: ${token.align[headerIdx]}`}
149+
dir="auto"
150+
>
150151
<div class="gap-1.5 text-left">
151152
<div class="shrink-0 break-normal">
152153
<MarkdownInlineTokens
@@ -166,14 +167,15 @@
166167
{#each token.rows as row, rowIdx}
167168
<tr class="bg-white dark:bg-gray-900 text-xs">
168169
{#each row ?? [] as cell, cellIdx}
169-
<td
170-
class="px-3! py-2! text-gray-900 dark:text-white w-max {token.rows.length -
171-
1 ===
172-
rowIdx
173-
? ''
174-
: 'border-b border-gray-50! dark:border-gray-850!'}"
175-
style={token.align[cellIdx] ? `text-align: ${token.align[cellIdx]}` : ''}
176-
>
170+
<td
171+
class="px-3! py-2! text-gray-900 dark:text-white w-max {token.rows.length -
172+
1 ===
173+
rowIdx
174+
? ''
175+
: 'border-b border-gray-50! dark:border-gray-850!'}"
176+
style={token.align[cellIdx] ? `text-align: ${token.align[cellIdx]}` : ''}
177+
dir="auto"
178+
>
177179
<div class="break-normal">
178180
<MarkdownInlineTokens
179181
id={`${id}-${tokenIdx}-row-${rowIdx}-${cellIdx}`}

0 commit comments

Comments
 (0)