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