File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -149,6 +149,7 @@ export class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockSchema> {
149
149
public readonly _tiptapEditor : TiptapEditor & { contentComponent : any } ;
150
150
public blockCache = new WeakMap < Node , Block < BSchema > > ( ) ;
151
151
public readonly schema : BSchema ;
152
+ private ready = false ;
152
153
153
154
public get domElement ( ) {
154
155
return this . _tiptapEditor . view . dom as HTMLDivElement ;
@@ -204,11 +205,24 @@ export class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockSchema> {
204
205
newOptions . onEditorReady ?.( this ) ;
205
206
newOptions . initialContent &&
206
207
this . replaceBlocks ( this . topLevelBlocks , newOptions . initialContent ) ;
208
+ this . ready = true ;
207
209
} ,
208
210
onUpdate : ( ) => {
211
+ // This seems to be necessary due to a bug in TipTap:
212
+ // https://github.com/ueberdosis/tiptap/issues/2583
213
+ if ( ! this . ready ) {
214
+ return ;
215
+ }
216
+
209
217
newOptions . onEditorContentChange ?.( this ) ;
210
218
} ,
211
219
onSelectionUpdate : ( ) => {
220
+ // This seems to be necessary due to a bug in TipTap:
221
+ // https://github.com/ueberdosis/tiptap/issues/2583
222
+ if ( ! this . ready ) {
223
+ return ;
224
+ }
225
+
212
226
newOptions . onTextCursorPositionChange ?.( this ) ;
213
227
} ,
214
228
editable : options . editable === undefined ? true : options . editable ,
You can’t perform that action at this time.
0 commit comments