Message: Switch-inline from bots should replace message input
This commit is contained in:
parent
29601e94f3
commit
680edbf3af
@ -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(() => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user