@tiptap/core 2.0.0-beta.197 → 2.0.0-beta.198

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.
@@ -273,7 +273,7 @@
273
273
  ...defaultAttribute,
274
274
  ...attribute,
275
275
  };
276
- if (attribute.isRequired && attribute.default === undefined) {
276
+ if ((attribute === null || attribute === void 0 ? void 0 : attribute.isRequired) && (attribute === null || attribute === void 0 ? void 0 : attribute.default) === undefined) {
277
277
  delete mergedAttr.default;
278
278
  }
279
279
  extensionAttributes.push({
@@ -539,11 +539,13 @@
539
539
 
540
540
  const getTextContentFromNodes = ($from, maxMatch = 500) => {
541
541
  let textBefore = '';
542
- $from.parent.nodesBetween(Math.max(0, $from.parentOffset - maxMatch), $from.parentOffset, (node, pos, parent, index) => {
543
- var _a, _b, _c;
544
- textBefore += ((_b = (_a = node.type.spec).toText) === null || _b === void 0 ? void 0 : _b.call(_a, {
542
+ const sliceEndPos = $from.parentOffset;
543
+ $from.parent.nodesBetween(Math.max(0, sliceEndPos - maxMatch), sliceEndPos, (node, pos, parent, index) => {
544
+ var _a, _b;
545
+ const chunk = ((_b = (_a = node.type.spec).toText) === null || _b === void 0 ? void 0 : _b.call(_a, {
545
546
  node, pos, parent, index,
546
- })) || ((_c = $from.nodeBefore) === null || _c === void 0 ? void 0 : _c.text) || '%leaf%';
547
+ })) || node.textContent || '%leaf%';
548
+ textBefore += chunk.slice(0, Math.max(0, sliceEndPos - pos));
547
549
  });
548
550
  return textBefore;
549
551
  };