An open source design system that's fully customizable and agent ready
TypeScript
fix(Chat): center inline tokens on the line box (#6418)
Geervan6d12a6f8afaf
diff --git a/.changeset/chat-token-line-alignment.md b/.changeset/chat-token-line-alignment.mdnew file mode 100644index 0000000000..a1b6bed70a--- /dev/null+++ b/.changeset/chat-token-line-alignment.md@@ -0,0 +1,7 @@+---+'@astryxdesign/core': patch+---++[fix] Chat: center inline tokens on the line box using 1lh and vertical-align top, fixing vertical misalignment against adjacent text and CJK characters.++@Geervandiff --git a/packages/core/src/Chat/ChatComposerInput.tsx b/packages/core/src/Chat/ChatComposerInput.tsxindex b25baa8bcd..82b9466c6f 100644--- a/packages/core/src/Chat/ChatComposerInput.tsx+++ b/packages/core/src/Chat/ChatComposerInput.tsx@@ -304,7 +304,9 @@ const styles = stylex.create({},tokenSpan: {display: 'inline-flex',- verticalAlign: 'middle',+ alignItems: 'center',+ height: '1lh',+ verticalAlign: 'top',},});diff --git a/packages/core/src/Chat/ChatTokenizedText.tsx b/packages/core/src/Chat/ChatTokenizedText.tsxindex 7c23bc0b90..0062f374e8 100644--- a/packages/core/src/Chat/ChatTokenizedText.tsx+++ b/packages/core/src/Chat/ChatTokenizedText.tsx@@ -37,7 +37,9 @@ const styles = stylex.create({},token: {display: 'inline-flex',- verticalAlign: 'middle',+ alignItems: 'center',+ height: '1lh',+ verticalAlign: 'top',},});diff --git a/packages/core/src/Chat/useChatComposerTokens.ts b/packages/core/src/Chat/useChatComposerTokens.tsindex 071303f08b..70855177ea 100644--- a/packages/core/src/Chat/useChatComposerTokens.ts+++ b/packages/core/src/Chat/useChatComposerTokens.ts@@ -120,7 +120,9 @@ export function useChatComposerTokens({span.setAttribute('data-astryx-token-id', id);span.contentEditable = 'false';span.style.display = 'inline-flex';- span.style.verticalAlign = 'middle';+ span.style.alignItems = 'center';+ span.style.height = '1lh';+ span.style.verticalAlign = 'top';range.deleteContents();range.insertNode(span);