fix: refocus editor when enter from background

This commit is contained in:
Ammar Ahmed
2022-06-08 23:07:25 +05:00
parent 3e808b9d68
commit cce06ed8b3

View File

@@ -27,10 +27,13 @@ export const EditorWrapper = ({ width }) => {
const floating = useIsFloatingKeyboard();
const onAppStateChanged = async state => {
if (editorState().movedAway) return;
if (state === 'active') {
if (!editorState().movedAway) {
editorController.current.onReady();
}
editorController.current.onReady();
// workaround: refocus editor when return from background
await editorController.current?.commands.focus();
} else {
await editorController.current?.commands?.blur();
}
};