@tiptap/core 2.0.0-beta.181 → 2.0.0-beta.182

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.
@@ -540,10 +540,10 @@
540
540
  const getTextContentFromNodes = ($from, maxMatch = 500) => {
541
541
  let textBefore = '';
542
542
  $from.parent.nodesBetween(Math.max(0, $from.parentOffset - maxMatch), $from.parentOffset, (node, pos, parent, index) => {
543
- var _a, _b;
543
+ var _a, _b, _c;
544
544
  textBefore += ((_b = (_a = node.type.spec).toText) === null || _b === void 0 ? void 0 : _b.call(_a, {
545
545
  node, pos, parent, index,
546
- })) || node.textContent || '%leaf%';
546
+ })) || ((_c = $from.nodeBefore) === null || _c === void 0 ? void 0 : _c.text) || '%leaf%';
547
547
  });
548
548
  return textBefore;
549
549
  };
@@ -1932,10 +1932,8 @@
1932
1932
  const setContent = (content, emitUpdate = false, parseOptions = {}) => ({ tr, editor, dispatch }) => {
1933
1933
  const { doc } = tr;
1934
1934
  const document = createDocument(content, editor.schema, parseOptions);
1935
- const selection = prosemirrorState.TextSelection.create(doc, 0, doc.content.size);
1936
1935
  if (dispatch) {
1937
- tr.setSelection(selection)
1938
- .replaceSelectionWith(document, false)
1936
+ tr.replaceWith(0, doc.content.size, document)
1939
1937
  .setMeta('preventUpdate', !emitUpdate);
1940
1938
  }
1941
1939
  return true;