@tiptap/core 2.5.4 → 2.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -577,7 +577,7 @@ const getTextContentFromNodes = ($from, maxMatch = 500) => {
577
577
  }))
578
578
  || node.textContent
579
579
  || '%leaf%';
580
- textBefore += chunk.slice(0, Math.max(0, sliceEndPos - pos));
580
+ textBefore += node.isAtom ? chunk : chunk.slice(0, Math.max(0, sliceEndPos - pos));
581
581
  });
582
582
  return textBefore;
583
583
  };
@@ -4206,6 +4206,11 @@ class Editor extends EventEmitter {
4206
4206
  }
4207
4207
  const state = this.state.apply(transaction);
4208
4208
  const selectionHasChanged = !this.state.selection.eq(state.selection);
4209
+ this.emit('beforeTransaction', {
4210
+ editor: this,
4211
+ transaction,
4212
+ nextState: state,
4213
+ });
4209
4214
  this.view.updateState(state);
4210
4215
  this.emit('transaction', {
4211
4216
  editor: this,