Skip to content

Commit 2d927e2

Browse files
authored
fix: do not use editor.dispatch (#1698)
1 parent 0ad2da6 commit 2d927e2

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

packages/core/src/schema/inlineContent/createSpec.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export function createInlineContentSpec<
123123

124124
addNodeView() {
125125
return ({ node, getPos }) => {
126-
const editor = this.options.editor;
126+
const editor = this.options.editor as BlockNoteEditor<any, any, S>;
127127

128128
const output = inlineContentImplementation.render(
129129
nodeToCustomInlineContent(
@@ -138,12 +138,8 @@ export function createInlineContentSpec<
138138

139139
const content = inlineContentToNodes([update], editor.pmSchema);
140140

141-
editor.dispatch(
142-
editor.prosemirrorView.state.tr.replaceWith(
143-
getPos(),
144-
getPos() + node.nodeSize,
145-
content,
146-
),
141+
editor.transact((tr) =>
142+
tr.replaceWith(getPos(), getPos() + node.nodeSize, content),
147143
);
148144
},
149145
editor,

0 commit comments

Comments
 (0)