Browse Source

Merge 78ef7c02aa into becaabfa0f

pull/10515/merge
Aarish mansur 15 hours ago committed by GitHub
parent
commit
aa2a505b52
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 9
      packages/excalidraw/wysiwyg/textWysiwyg.tsx

9
packages/excalidraw/wysiwyg/textWysiwyg.tsx

@ -577,6 +577,11 @@ export const textWysiwyg = ({
}); });
}; };
const handleBlur = ()=>{
if(!document.hasFocus()) return ;
handleSubmit();
}
const cleanup = () => { const cleanup = () => {
// remove events to ensure they don't late-fire // remove events to ensure they don't late-fire
editable.onblur = null; editable.onblur = null;
@ -626,7 +631,7 @@ export const textWysiwyg = ({
} }
// Otherwise, re-enable submit on blur and refocus the editor. // Otherwise, re-enable submit on blur and refocus the editor.
editable.onblur = handleSubmit; editable.onblur = handleBlur;
editable.focus(); editable.focus();
}); });
}; };
@ -636,7 +641,7 @@ export const textWysiwyg = ({
window.addEventListener("pointerup", bindBlurEvent); window.addEventListener("pointerup", bindBlurEvent);
// handle edge-case where pointerup doesn't fire e.g. due to user // handle edge-case where pointerup doesn't fire e.g. due to user
// alt-tabbing away // alt-tabbing away
window.addEventListener("blur", handleSubmit); window.addEventListener("blur", handleBlur);
}; };
// prevent blur when changing properties from the menu // prevent blur when changing properties from the menu

Loading…
Cancel
Save