Message: Switch-inline from bots should replace message input

This commit is contained in:
Alexander Zinchuk 2025-09-19 14:34:22 +02:00
parent 29601e94f3
commit 680edbf3af

View File

@ -616,7 +616,14 @@ const Composer: FC<OwnProps & StateProps> = ({
}
}
setHtml(!shouldPrepend ? `${getHtml()}${newHtml}` : `${newHtml}${getHtml()}`);
if (shouldPrepend) {
const newFirstWord = newHtml.split(' ')[0];
const shouldReplace = getHtml().startsWith(newFirstWord);
setHtml(shouldReplace ? newHtml : `${newHtml}${getHtml()}`);
} else {
setHtml(`${getHtml()}${newHtml}`);
}
// If selection is outside of input, set cursor at the end of input
requestNextMutation(() => {