From 9b4057d0a2588fb3686769672e01e2706cced608 Mon Sep 17 00:00:00 2001 From: Balazs Bajorics <2226774+balazsbajorics@users.noreply.github.com> Date: Thu, 7 Nov 2024 17:36:41 +0100 Subject: [PATCH] keep live mode on blur (#6615) #6593 Aggressively switches to edit mode on blur, but we only want that to happen if the user is in insert mode (which means a draw-to-insert interaction). **Fix** only switch to edit mode if the current mode is insert mode --- editor/src/templates/editor.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/editor/src/templates/editor.tsx b/editor/src/templates/editor.tsx index 74de72b62d77..0f5f22c96362 100644 --- a/editor/src/templates/editor.tsx +++ b/editor/src/templates/editor.tsx @@ -410,11 +410,15 @@ export class Editor { } resetStateOnBlur = (): void => { + const currentMode = this.storedState.patchedEditor.mode + this.boundDispatch( [ EditorActions.clearHighlightedViews(), CanvasActions.clearInteractionSession(false), - EditorActions.switchEditorMode(EditorModes.selectMode(null, false, 'none')), + ...(currentMode.type === 'insert' + ? [EditorActions.switchEditorMode(EditorModes.selectMode(null, false, 'none'))] + : []), EditorActions.updateKeys({}), EditorActions.closePopup(), EditorActions.clearPostActionData(),