fixed message edit overtaking the autocomplete for enter
This commit is contained in:
1 parent
61151ae909
commit
ad9997756a
2 files changed
+9
-2
No files matched your search
@@ -51,7 +51,7 @@ export function AutocompleteMenu({
|
||||
<FocusTrap
|
||||
active={isActive}
|
||||
focusTrapOptions={{
|
||||
initialFocus: () => false,
|
||||
initialFocus: false,
|
||||
onPostDeactivate: handleDeactivate,
|
||||
returnFocusOnDeactivate: false,
|
||||
clickOutsideDeactivates: true,
|
||||
|
||||
@@ -280,6 +280,13 @@ export const MessageEditor = as<'div', MessageEditorProps>(
|
||||
(isKeyHotkey('mod+enter', evt) || (!enterForNewline && isKeyHotkey('enter', evt))) &&
|
||||
!isComposing(evt)
|
||||
) {
|
||||
const prevWordRange = getPrevWorldRange(editor);
|
||||
if (
|
||||
prevWordRange &&
|
||||
getAutocompleteQuery(editor, prevWordRange, ANYWHERE_AUTOCOMPLETE_PREFIXES)
|
||||
)
|
||||
return;
|
||||
|
||||
evt.preventDefault();
|
||||
handleSave();
|
||||
}
|
||||
@@ -288,7 +295,7 @@ export const MessageEditor = as<'div', MessageEditorProps>(
|
||||
onCancel();
|
||||
}
|
||||
},
|
||||
[onCancel, handleSave, enterForNewline, isComposing]
|
||||
[enterForNewline, isComposing, editor, handleSave, onCancel]
|
||||
);
|
||||
|
||||
const handleKeyUp: KeyboardEventHandler = useCallback(
|
||||
|
||||
Reference in new issue
Block a user