fix type to focus not working after room switch (#1866)

This commit is contained in:
Ajay Bura 2024-08-04 11:34:11 +05:30 committed by GitHub
parent cfe893f358
commit cabfdd47b5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -186,9 +186,8 @@ export const RoomInput = forwardRef<HTMLDivElement, RoomInputProps>(
Transforms.insertFragment(editor, msgDraft);
}, [editor, msgDraft]);
useEffect(() => {
if (!mobileOrTablet()) ReactEditor.focus(editor);
return () => {
useEffect(
() => () => {
if (!isEmptyEditor(editor)) {
const parsedDraft = JSON.parse(JSON.stringify(editor.children));
setMsgDraft(parsedDraft);
@ -197,8 +196,9 @@ export const RoomInput = forwardRef<HTMLDivElement, RoomInputProps>(
}
resetEditor(editor);
resetEditorHistory(editor);
};
}, [roomId, editor, setMsgDraft]);
},
[roomId, editor, setMsgDraft]
);
const handleRemoveUpload = useCallback(
(upload: TUploadContent | TUploadContent[]) => {