Skip to content

fix: immediately add nodeviews to fix flushSync error #1546

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 19, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions packages/core/src/editor/BlockNoteTipTapEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,19 +174,21 @@ export class BlockNoteTipTapEditor extends TiptapEditor {
dispatchTransaction: this.dispatchTransaction.bind(this),
state: this.state,
markViews,
nodeViews: this.extensionManager.nodeViews,
}
);

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

this.view.updateState(newState);

this.createNodeViews();

// emit the created event, call here manually because we blocked the default call in the constructor
// (https://github.com/ueberdosis/tiptap/blob/45bac803283446795ad1b03f43d3746fa54a68ff/packages/core/src/Editor.ts#L117)
this.commands.focus(
Expand Down
Loading