chore(deps): sync upstream changes (2026-08-26) #5

Merged
imnyang merged 27 commits from upstream-sync-202608261421 into dev 2026-08-26 14:37:20 +09:00
3 changed files with 8 additions and 8 deletions
Showing only changes of commit c434e0dda3 - Show all commits

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
wjaaaaaaat 2026-08-11 00:23:15 -04:00 committed by GitHub
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -241,15 +241,15 @@ export const getPointUntilChar = (
return targetPoint;
};
export const getPrevWorldRange = (editor: Editor): BaseRange | undefined => {
export const getPrevWordRange = (editor: Editor): BaseRange | undefined => {
const { selection } = editor;
if (!selection || !Range.isCollapsed(selection)) return undefined;
const [cursorPoint] = Range.edges(selection);
const worldStartPoint = getPointUntilChar(editor, cursorPoint, {
const wordStartPoint = getPointUntilChar(editor, cursorPoint, {
reverse: true,
match: (char) => char === ' ',
match: (char) => char === ' ' || char === '',
});
return worldStartPoint && Editor.range(editor, worldStartPoint, cursorPoint);
return wordStartPoint && Editor.range(editor, wordStartPoint, cursorPoint);
};
export const isEmptyEditor = (editor: Editor): boolean => {

View file

@ -39,7 +39,7 @@ import {
AutocompletePrefix,
AutocompleteQuery,
getAutocompleteQuery,
getPrevWorldRange,
getPrevWordRange,
resetEditor,
RoomMentionAutocomplete,
UserMentionAutocomplete,
@ -411,7 +411,7 @@ export const RoomInput = forwardRef<HTMLDivElement, RoomInputProps>(
sendTypingStatus(!isEmptyEditor(editor));
}
const prevWordRange = getPrevWorldRange(editor);
const prevWordRange = getPrevWordRange(editor);
const query = prevWordRange
? getAutocompleteQuery<AutocompletePrefix>(editor, prevWordRange, AUTOCOMPLETE_PREFIXES)
: undefined;

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;