Skip to content
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
17 changes: 16 additions & 1 deletion packages/core/src/editor/BlockNoteEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -871,8 +871,23 @@ export class BlockNoteEditor<
this._tiptapEditor.mount(this, parentElement, contentComponent);
};

/**
* Get the underlying prosemirror state
* @note Prefer using `editor.transact` to read the current editor state, as that will ensure the state is up to date
* @see https://prosemirror.net/docs/ref/#state.EditorState
*/
public get prosemirrorState() {
if (this.activeTransaction) {
throw new Error(
"`prosemirrorState` should not be called within a `transact` call, move the `prosemirrorState` call outside of the `transact` call or use `editor.transact` to read the current editor state"
);
}
return this._tiptapEditor.state;
}

/**
* Get the underlying prosemirror view
* @see https://prosemirror.net/docs/ref/#view.EditorView
*/
public get prosemirrorView() {
return this._tiptapEditor.view;
Expand Down Expand Up @@ -1034,7 +1049,7 @@ export class BlockNoteEditor<
* Executes a callback whenever the editor's contents change.
* @param callback The callback to execute.
*
* @deprecated use `onChange` instead
* @deprecated use {@link BlockNoteEditor.onChange} instead
*/
public onEditorContentChange(callback: () => void) {
this._tiptapEditor.on("update", callback);
Expand Down
Loading