fix: fix some react focus issues (#1724), fix #1716, fix #1608, fix #1520

* remove async createNodeViews

* focus asynchronously to fix weird bugs in react
This commit is contained in:
Philipp Kühn
2021-08-12 18:03:45 +02:00
committed by GitHub
parent 812c49bcb1
commit 956566eaad
5 changed files with 46 additions and 27 deletions

View File

@@ -11,10 +11,12 @@ declare module '@tiptap/core' {
}
}
export const blur: RawCommands['blur'] = () => ({ view }) => {
const element = view.dom as HTMLElement
element.blur()
export const blur: RawCommands['blur'] = () => ({ editor, view }) => {
requestAnimationFrame(() => {
if (!editor.isDestroyed) {
(view.dom as HTMLElement).blur()
}
})
return true
}