Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/chat-token-line-alignment.md
Original file line number Diff line number Diff line change
@@ -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.

@Geervan
4 changes: 3 additions & 1 deletion packages/core/src/Chat/ChatComposerInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,9 @@ const styles = stylex.create({
},
tokenSpan: {
display: 'inline-flex',
verticalAlign: 'middle',
alignItems: 'center',
height: '1lh',
verticalAlign: 'top',
},
});

Expand Down
4 changes: 3 additions & 1 deletion packages/core/src/Chat/ChatTokenizedText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ const styles = stylex.create({
},
token: {
display: 'inline-flex',
verticalAlign: 'middle',
alignItems: 'center',
height: '1lh',
verticalAlign: 'top',
},
});

Expand Down
4 changes: 3 additions & 1 deletion packages/core/src/Chat/useChatComposerTokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading