Skip to content

Commit

Permalink
fix: fix removing the caret on blur in some situations when using saf…
Browse files Browse the repository at this point in the history
…ari, fix #2405
  • Loading branch information
Philipp Kühn authored and Philipp Kühn committed Jan 20, 2022
1 parent 9e48f8c commit 9d31712
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/core/src/commands/blur.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ export const blur: RawCommands['blur'] = () => ({ editor, view }) => {
requestAnimationFrame(() => {
if (!editor.isDestroyed) {
(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()
}
})

Expand Down

0 comments on commit 9d31712

Please sign in to comment.