Fix Composer deleting text before submitting
Fixes #1618 (closed)
- Prevent the Submit button from being clicked if it would cause this bug (check presence of
editorRef.current
andtext.length
) - Autofocus the LexicalEditor on mobile
In order for the editorRef to be set, it seems that the editor needs to become focused. So it makes sense to just autofocus it on mobile when it mounts. I don't really understand why it's needed, but between the two of these things (preventing the submit, and autofocus), it fixes the bug.