Fix caret jumps for web composer (#1374)
* Fix caret jumps for web composer * Autofocus at the end on mount
This commit is contained in:
parent
419ac2d0df
commit
161746519c
1 changed files with 2 additions and 5 deletions
|
@ -111,10 +111,7 @@ export const TextInput = React.forwardRef(
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
content: textToEditorJson(richtext.text.toString()),
|
content: textToEditorJson(richtext.text.toString()),
|
||||||
onFocus: ({editor: e}) => {
|
autofocus: 'end',
|
||||||
e.chain().focus().setTextSelection(richtext.text.length).run() // focus to the end of the text
|
|
||||||
},
|
|
||||||
autofocus: true,
|
|
||||||
editable: true,
|
editable: true,
|
||||||
injectCSS: true,
|
injectCSS: true,
|
||||||
onUpdate({editor: editorProp}) {
|
onUpdate({editor: editorProp}) {
|
||||||
|
@ -146,7 +143,7 @@ export const TextInput = React.forwardRef(
|
||||||
|
|
||||||
const onEmojiInserted = React.useCallback(
|
const onEmojiInserted = React.useCallback(
|
||||||
(emoji: Emoji) => {
|
(emoji: Emoji) => {
|
||||||
editor?.chain().focus('end').insertContent(emoji.native).run()
|
editor?.chain().focus().insertContent(emoji.native).run()
|
||||||
},
|
},
|
||||||
[editor],
|
[editor],
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue