Skip to content

Commit a205478

Browse files
authored
fix: immediately add nodeviews to fix flushSync error (#1546)
1 parent f8effcc commit a205478

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/core/src/editor/BlockNoteTipTapEditor.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,19 +174,21 @@ export class BlockNoteTipTapEditor extends TiptapEditor {
174174
dispatchTransaction: this.dispatchTransaction.bind(this),
175175
state: this.state,
176176
markViews,
177+
nodeViews: this.extensionManager.nodeViews,
177178
}
178179
);
179180

180181
// `editor.view` is not yet available at this time.
181-
// Therefore we will add all plugins and node views directly afterwards.
182+
// Therefore we will add all plugins directly afterwards.
183+
//
184+
// To research: this is the default tiptap behavior, but might actually not be necessary
185+
// it feels like it's a workaround for plugins that don't account for the view not being available yet
182186
const newState = this.state.reconfigure({
183187
plugins: this.extensionManager.plugins,
184188
});
185189

186190
this.view.updateState(newState);
187191

188-
this.createNodeViews();
189-
190192
// emit the created event, call here manually because we blocked the default call in the constructor
191193
// (https://github.com/ueberdosis/tiptap/blob/45bac803283446795ad1b03f43d3746fa54a68ff/packages/core/src/Editor.ts#L117)
192194
this.commands.focus(

0 commit comments

Comments
 (0)