Skip to content

Commit 760d76e

Browse files
committed
fix: do not even worry about tiptap transactions
1 parent 26440c0 commit 760d76e

File tree

1 file changed

+7
-21
lines changed

1 file changed

+7
-21
lines changed

packages/core/src/editor/BlockNoteEditor.ts

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -800,41 +800,27 @@ export class BlockNoteEditor<
800800
return callback();
801801
}
802802

803-
let result: T = undefined as T;
804-
805803
try {
806804
// Enter transaction mode, by setting a start state
807805
this.transactionState = this.prosemirrorState;
808806

809-
// Capture all tiptap transactions (tiptapEditor.dispatch'd transactions)
810-
const tiptapTr = this._tiptapEditor.captureTransaction(() => {
811-
// This is more of a safety mechanism, as we catch blocknote transactions separately
812-
result = callback();
813-
});
807+
// Capture all dispatch'd transactions
808+
const result = callback();
814809

815810
// Any transactions captured by the `dispatch` call will be stored in `this.activeTransaction`
816-
let activeTr = this.activeTransaction;
817-
818-
if (tiptapTr && activeTr) {
819-
// If we have both tiptap & blocknote transactions, there is not a clean way to merge them as you'd need to know the order of operations
820-
throw new Error(
821-
"Cannot mix tiptap transactions with BlockNote transactions"
822-
);
823-
} else if (tiptapTr) {
824-
// If we only have tiptap caught transactions, we can just use that
825-
activeTr = tiptapTr;
826-
}
811+
const activeTr = this.activeTransaction;
827812

813+
this.transactionState = null;
828814
if (activeTr) {
815+
this.activeTransaction = null;
829816
// Dispatch the transaction if it was modified
830-
this._tiptapEditor.dispatch(activeTr);
817+
this.dispatch(activeTr);
831818
}
819+
return result;
832820
} finally {
833821
this.activeTransaction = null;
834822
this.transactionState = null;
835823
}
836-
837-
return result;
838824
}
839825

840826
/**

0 commit comments

Comments
 (0)