@tiptap/react 2.24.1 → 2.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ReactRenderer.d.ts.map +1 -1
- package/dist/index.cjs +13 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -4
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +13 -3
- package/dist/index.umd.js.map +1 -1
- package/package.json +5 -5
- package/src/ReactRenderer.tsx +13 -3
package/src/ReactRenderer.tsx
CHANGED
|
@@ -8,6 +8,7 @@ import type {
|
|
|
8
8
|
RefAttributes,
|
|
9
9
|
} from 'react'
|
|
10
10
|
import React, { version as reactVersion } from 'react'
|
|
11
|
+
import { flushSync } from 'react-dom'
|
|
11
12
|
|
|
12
13
|
import { EditorWithContentComponent } from './Editor.js'
|
|
13
14
|
|
|
@@ -184,9 +185,18 @@ export class ReactRenderer<R = unknown, P extends Record<string, any> = object>
|
|
|
184
185
|
this.element.classList.add(...className.split(' '))
|
|
185
186
|
}
|
|
186
187
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
188
|
+
// If the editor is already initialized, we will need to
|
|
189
|
+
// synchronously render the component to ensure it renders
|
|
190
|
+
// together with Prosemirror's rendering.
|
|
191
|
+
if (this.editor.isInitialized) {
|
|
192
|
+
flushSync(() => {
|
|
193
|
+
this.render()
|
|
194
|
+
})
|
|
195
|
+
} else {
|
|
196
|
+
queueMicrotask(() => {
|
|
197
|
+
this.render()
|
|
198
|
+
})
|
|
199
|
+
}
|
|
190
200
|
}
|
|
191
201
|
|
|
192
202
|
/**
|