fix: emoji autocompletion overwriting preceding element (#3064)

* fix getPrevWorldRange to exclude empty text children

this prevents the range from encroaching on the node of elements like emojis and pings to prevent them from being overwritten

* fix typo of "word" as "world"

* trigger pr checks
This commit is contained in:
wjaaaaaaat 2026-08-11 00:23:15 -04:00 committed by GitHub
commit c434e0dda3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 8 additions and 8 deletions

View file

@ -35,7 +35,7 @@ import {
createEmoticonElement,
customHtmlEqualsPlainText,
getAutocompleteQuery,
getPrevWorldRange,
getPrevWordRange,
htmlToEditorInput,
moveCursor,
plainToEditorInput,
@ -187,7 +187,7 @@ export const MessageEditor = as<'div', MessageEditorProps>(
return;
}
const prevWordRange = getPrevWorldRange(editor);
const prevWordRange = getPrevWordRange(editor);
const query = prevWordRange
? getAutocompleteQuery<AutocompletePrefix>(editor, prevWordRange, AUTOCOMPLETE_PREFIXES)
: undefined;