From 967ad7707847b70f6e7980de0a360a32f45c6321 Mon Sep 17 00:00:00 2001 From: Aaryan Khandelwal <65252264+aaryan610@users.noreply.github.com> Date: Tue, 7 May 2024 15:49:11 +0530 Subject: [PATCH] fix: set focus on editor conditionally after image upload (#4387) --- packages/editor/core/src/ui/plugins/upload-image.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/editor/core/src/ui/plugins/upload-image.tsx b/packages/editor/core/src/ui/plugins/upload-image.tsx index af56d5382..7a370da4e 100644 --- a/packages/editor/core/src/ui/plugins/upload-image.tsx +++ b/packages/editor/core/src/ui/plugins/upload-image.tsx @@ -158,7 +158,7 @@ export async function startImageUpload( const transaction = view.state.tr.insert(pos - 1, node).setMeta(uploadKey, { remove: { id } }); view.dispatch(transaction); - view.focus(); + if (view.hasFocus()) view.focus(); editor.storage.image.uploadInProgress = false; } catch (error) { removePlaceholder(editor, view, id);