Hackfix to composer focus on web (#2057)
parent
0ab19b45a2
commit
a01497fed4
|
@ -116,6 +116,16 @@ export const TextInput = React.forwardRef(function TextInputImpl(
|
||||||
autofocus: 'end',
|
autofocus: 'end',
|
||||||
editable: true,
|
editable: true,
|
||||||
injectCSS: true,
|
injectCSS: true,
|
||||||
|
onCreate({editor: editorProp}) {
|
||||||
|
// HACK
|
||||||
|
// the 'enter' animation sometimes causes autofocus to fail
|
||||||
|
// (see Composer.web.tsx in shell)
|
||||||
|
// so we wait 200ms (the anim is 150ms) and then focus manually
|
||||||
|
// -prf
|
||||||
|
setTimeout(() => {
|
||||||
|
editorProp.chain().focus('end').run()
|
||||||
|
}, 200)
|
||||||
|
},
|
||||||
onUpdate({editor: editorProp}) {
|
onUpdate({editor: editorProp}) {
|
||||||
const json = editorProp.getJSON()
|
const json = editorProp.getJSON()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue