浏览代码

Auto text direction (fix for RTL) in most cases

to test it use the prompt:
"write please a sample headers (level 1,2,3), text (bold/italic), list, numbered list, quetes, table, code
write each example in hebrew
dont output markdown in code block"

need to be fixed:
* Redundant border properties in quotes:
Removed border-left as border-inline-start properly handles both LTR/RTL and by this prevents double borders in RTL layouts

* table header have `text-align: left` instead of start
e.g.
text-align and direction is not the save thing
the text direction is ok. the `dir="auto"` is fixing the direction שמג the text-align by default is set by the direction, if it set manually is should be start/end to respect the direction attribute
Elkana Bardugo 2 月之前
父节点
当前提交
ab94017e3a
共有 1 个文件被更改,包括 5 次插入5 次删除
  1. 5 5
      src/lib/components/chat/Messages/Markdown/MarkdownTokens.svelte

+ 5 - 5
src/lib/components/chat/Messages/Markdown/MarkdownTokens.svelte

@@ -169,14 +169,14 @@
 			</div>
 			</div>
 		</div>
 		</div>
 	{:else if token.type === 'blockquote'}
 	{:else if token.type === 'blockquote'}
-		<blockquote>
+		<blockquote dir="auto">
 			<svelte:self id={`${id}-${tokenIdx}`} tokens={token.tokens} {onTaskClick} {onSourceClick} />
 			<svelte:self id={`${id}-${tokenIdx}`} tokens={token.tokens} {onTaskClick} {onSourceClick} />
 		</blockquote>
 		</blockquote>
 	{:else if token.type === 'list'}
 	{:else if token.type === 'list'}
 		{#if token.ordered}
 		{#if token.ordered}
 			<ol start={token.start || 1}>
 			<ol start={token.start || 1}>
 				{#each token.items as item, itemIdx}
 				{#each token.items as item, itemIdx}
-					<li>
+					<li dir="auto">
 						{#if item?.task}
 						{#if item?.task}
 							<input
 							<input
 								class=" translate-y-[1px] -translate-x-1"
 								class=" translate-y-[1px] -translate-x-1"
@@ -208,7 +208,7 @@
 		{:else}
 		{:else}
 			<ul>
 			<ul>
 				{#each token.items as item, itemIdx}
 				{#each token.items as item, itemIdx}
-					<li>
+					<li dir="auto">
 						{#if item?.task}
 						{#if item?.task}
 							<input
 							<input
 								class=" translate-y-[1px] -translate-x-1"
 								class=" translate-y-[1px] -translate-x-1"
@@ -268,7 +268,7 @@
 			onload="this.style.height=(this.contentWindow.document.body.scrollHeight+20)+'px';"
 			onload="this.style.height=(this.contentWindow.document.body.scrollHeight+20)+'px';"
 		></iframe>
 		></iframe>
 	{:else if token.type === 'paragraph'}
 	{:else if token.type === 'paragraph'}
-		<p>
+		<p dir="auto">
 			<MarkdownInlineTokens
 			<MarkdownInlineTokens
 				id={`${id}-${tokenIdx}-p`}
 				id={`${id}-${tokenIdx}-p`}
 				tokens={token.tokens ?? []}
 				tokens={token.tokens ?? []}
@@ -277,7 +277,7 @@
 		</p>
 		</p>
 	{:else if token.type === 'text'}
 	{:else if token.type === 'text'}
 		{#if top}
 		{#if top}
-			<p>
+			<p dir="auto">
 				{#if token.tokens}
 				{#if token.tokens}
 					<MarkdownInlineTokens id={`${id}-${tokenIdx}-t`} tokens={token.tokens} {onSourceClick} />
 					<MarkdownInlineTokens id={`${id}-${tokenIdx}-t`} tokens={token.tokens} {onSourceClick} />
 				{:else}
 				{:else}