fix: fix removing the caret on blur in some situations when using safari, fix #2405

This commit is contained in:
Philipp Kühn
2022-01-20 21:37:31 +01:00
parent 9e48f8c239
commit 9d317128a0

View File

@@ -15,6 +15,10 @@ export const blur: RawCommands['blur'] = () => ({ editor, view }) => {
requestAnimationFrame(() => { requestAnimationFrame(() => {
if (!editor.isDestroyed) { if (!editor.isDestroyed) {
(view.dom as HTMLElement).blur() (view.dom as HTMLElement).blur()
// Browsers should remove the caret on blur but safari does not.
// See: https://github.com/ueberdosis/tiptap/issues/2405
window?.getSelection()?.removeAllRanges()
} }
}) })