Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
26440c0
feat(core): add blocknote transactions
nperez0111 Apr 4, 2025
760d76e
fix: do not even worry about tiptap transactions
nperez0111 Apr 4, 2025
77f1bee
fix: execute `updateBlock` as a transaction
nperez0111 Apr 4, 2025
4a3d364
chore: use replace step to insert blocks
nperez0111 Apr 4, 2025
eb849cd
chore: remove use of ttEditor
nperez0111 Apr 7, 2025
fc60121
chore: clarifying comments
nperez0111 Apr 9, 2025
35a7753
fix: switch to only using transactions instead of prosemirrorState
nperez0111 Apr 11, 2025
3dc0fcd
test: intentionally failing test
nperez0111 Apr 11, 2025
ffc4a5b
fix: apply plugin `appendedTransactions`
nperez0111 Apr 11, 2025
7133bc8
revert: "fix: apply plugin `appendedTransactions`"
nperez0111 Apr 14, 2025
6fac1fd
refactor: blocknote API uses lowest possible level prosemirror primit…
nperez0111 Apr 14, 2025
934adc5
chore: use tr state instead of prosemirrorState
nperez0111 Apr 14, 2025
34ebafa
refactor: update the updateBlock command
nperez0111 Apr 15, 2025
6e1d9d6
refactor: use high-level methods for moveBlocks
nperez0111 Apr 15, 2025
2980c6c
refactor: stash into `cached` schema property
nperez0111 Apr 15, 2025
777ed99
refactor: make everything based on editor schema
nperez0111 Apr 15, 2025
9284a85
chore: update
nperez0111 Apr 15, 2025
ddfed65
refactor: make dispatch private
nperez0111 Apr 15, 2025
402dd37
refactor: make `transaction` private
nperez0111 Apr 15, 2025
7ee1c42
refactor: remove reading from `prosemirrorState` add `exec` and `canE…
nperez0111 Apr 16, 2025
cc23f3f
fix: have dispatch be bound
nperez0111 Apr 16, 2025
9511604
fix: throw an error for canExec too
nperez0111 Apr 16, 2025
47de76e
chore: rm transactions test
nperez0111 Apr 16, 2025
3440c3d
refactor: reorganize the arguments
nperez0111 Apr 16, 2025
6a9230b
Merge branch 'main' into feat/blocknote-transactions-3
nperez0111 Apr 16, 2025
387088d
refactor: do not use prosemirrorState
nperez0111 Apr 16, 2025
6e6c5fd
chore: add jsdoc
nperez0111 Apr 16, 2025
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: apply plugin appendedTransactions
  • Loading branch information
nperez0111 committed Apr 11, 2025
commit ffc4a5b83d28df9f7532a28d266ab79bb48809f5
30 changes: 28 additions & 2 deletions packages/core/src/editor/BlockNoteEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,12 @@ import {
import { Dictionary } from "../i18n/dictionary.js";
import { en } from "../i18n/locales/index.js";

import { Plugin, TextSelection, Transaction } from "@tiptap/pm/state";
import {
Plugin,
TextSelection,
Transaction,
Selection as ProsemirrorSelection,
} from "@tiptap/pm/state";
import { dropCursor } from "prosemirror-dropcursor";
import { EditorView } from "prosemirror-view";
import { ySyncPluginKey } from "y-prosemirror";
Expand Down Expand Up @@ -738,7 +743,28 @@ export class BlockNoteEditor<
*/
public dispatch(tr: Transaction) {
if (this.activeTransaction) {
// We don't want the editor to actually apply the state, so all of this is manipulating the current transaction in-memory
// The user wanted to dispatch, but we are already in a transaction, so we don't want to apply the state

// We do want to append any transactions though, so we'll do that
const { transactions } = this._tiptapEditor.state.applyTransaction(tr);

this.activeTransaction = transactions.reduce((activeTr, trToApply) => {
trToApply.steps.forEach((step) => {
activeTr.step(step);
});
if (trToApply.selectionSet) {
// Serialize the selection to JSON, because the document between the `activeTransaction` and the dispatch'd tr are different references
activeTr.setSelection(
ProsemirrorSelection.fromJSON(
this.activeTransaction!.doc,
trToApply.selection.toJSON()
)
);
}

return activeTr;
});

return;
}

Expand Down
Loading