diff options
author | dan <dan.abramov@gmail.com> | 2023-09-05 08:21:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-05 08:21:10 +0100 |
commit | 161746519c4c2bc82d08b9bb24c12e6b90ce6078 (patch) | |
tree | a7ba09f728a3a82483e56022dfb1f2e17cc3ddce /src/view/com/composer/text-input/TextInput.web.tsx | |
parent | 419ac2d0df013db08bec0eb9cef8e6fd5a0bcd33 (diff) | |
download | voidsky-161746519c4c2bc82d08b9bb24c12e6b90ce6078.tar.zst |
Fix caret jumps for web composer (#1374)
* Fix caret jumps for web composer * Autofocus at the end on mount
Diffstat (limited to 'src/view/com/composer/text-input/TextInput.web.tsx')
-rw-r--r-- | src/view/com/composer/text-input/TextInput.web.tsx | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/view/com/composer/text-input/TextInput.web.tsx b/src/view/com/composer/text-input/TextInput.web.tsx index 395263af8..77f634930 100644 --- a/src/view/com/composer/text-input/TextInput.web.tsx +++ b/src/view/com/composer/text-input/TextInput.web.tsx @@ -111,10 +111,7 @@ export const TextInput = React.forwardRef( }, }, content: textToEditorJson(richtext.text.toString()), - onFocus: ({editor: e}) => { - e.chain().focus().setTextSelection(richtext.text.length).run() // focus to the end of the text - }, - autofocus: true, + autofocus: 'end', editable: true, injectCSS: true, onUpdate({editor: editorProp}) { @@ -146,7 +143,7 @@ export const TextInput = React.forwardRef( const onEmojiInserted = React.useCallback( (emoji: Emoji) => { - editor?.chain().focus('end').insertContent(emoji.native).run() + editor?.chain().focus().insertContent(emoji.native).run() }, [editor], ) |