Fix empty state placeholder alignment in RichChatInput

- Changed placeholder container from flex items-center to match content structure
- Applied same whitespace-pre-wrap, min-h-[1.5em], and leading-relaxed classes
- Standardized cursor styling with align-baseline and consistent margins
- Ensures empty state and content state have identical vertical positioning
- Eliminates awkward upward shift when transitioning from empty to content state
This commit is contained in:
spencrmartin
2025-09-25 13:07:42 -04:00
parent c0c45294f2
commit 5208d22fe7
+6 -4
View File
@@ -301,14 +301,16 @@ export const RichChatInput = forwardRef<RichChatInputRef, RichChatInputProps>(({
// Show placeholder when there's no text content (but account for whitespace-only content with newlines)
if (!value || (value.trim() === '' && !value.includes('\n'))) {
return (
<div className="relative min-h-[1.5em] flex items-center justify-start h-full">
<div className="whitespace-pre-wrap min-h-[1.5em] leading-relaxed">
{isFocused && cursorPosition === 0 && (
<span
className="border-l-2 border-text-default inline-block"
className="border-l-2 border-text-default inline-block align-baseline"
style={{
animation: "blink 1s step-end infinite",
height: "1.2em",
marginRight: placeholder ? "4px" : "0px"
height: "1em",
marginLeft: "1px",
marginRight: placeholder ? "4px" : "0px",
verticalAlign: "baseline"
}}
/>
)}