Composer: Fix space when editing text (#5862)

This commit is contained in:
Alexander Zinchuk 2025-04-23 18:59:43 +02:00
parent 888e740b39
commit a72abc5cbc

View File

@ -25,7 +25,7 @@ import captureKeyboardListeners from '../../../util/captureKeyboardListeners';
import { getIsDirectTextInputDisabled } from '../../../util/directInputManager'; import { getIsDirectTextInputDisabled } from '../../../util/directInputManager';
import parseEmojiOnlyString from '../../../util/emoji/parseEmojiOnlyString'; import parseEmojiOnlyString from '../../../util/emoji/parseEmojiOnlyString';
import focusEditableElement from '../../../util/focusEditableElement'; import focusEditableElement from '../../../util/focusEditableElement';
import { debounce } from '../../../util/schedulers'; import { debounce, fastRaf } from '../../../util/schedulers';
import renderText from '../../common/helpers/renderText'; import renderText from '../../common/helpers/renderText';
import { isSelectionInsideInput } from './helpers/selection'; import { isSelectionInsideInput } from './helpers/selection';
@ -208,6 +208,8 @@ const MessageInput: FC<OwnProps & StateProps> = ({
? MAX_ATTACHMENT_MODAL_INPUT_HEIGHT ? MAX_ATTACHMENT_MODAL_INPUT_HEIGHT
: isStoryInput ? MAX_STORY_MODAL_INPUT_HEIGHT : (isMobile ? 256 : 416); : isStoryInput ? MAX_STORY_MODAL_INPUT_HEIGHT : (isMobile ? 256 : 416);
const updateInputHeight = useLastCallback((willSend = false) => { const updateInputHeight = useLastCallback((willSend = false) => {
// Defer to avoid animation/layout conflicts during DOM updates
fastRaf(() => {
requestForcedReflow(() => { requestForcedReflow(() => {
const scroller = inputRef.current!.closest<HTMLDivElement>(`.${SCROLLER_CLASS}`)!; const scroller = inputRef.current!.closest<HTMLDivElement>(`.${SCROLLER_CLASS}`)!;
const currentHeight = Number(scroller.style.height.replace('px', '')); const currentHeight = Number(scroller.style.height.replace('px', ''));
@ -239,6 +241,7 @@ const MessageInput: FC<OwnProps & StateProps> = ({
} }
}); });
}); });
});
useLayoutEffect(() => { useLayoutEffect(() => {
if (!isAttachmentModalInput) return; if (!isAttachmentModalInput) return;