Hackfix to composer focus on web (#2057)

zio/stable
Paul Frazee 2023-12-03 18:45:25 -08:00 committed by GitHub
parent 0ab19b45a2
commit a01497fed4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 0 deletions

View File

@ -116,6 +116,16 @@ export const TextInput = React.forwardRef(function TextInputImpl(
autofocus: 'end',
editable: 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}) {
const json = editorProp.getJSON()