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

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.
@@ -279,7 +279,7 @@ function getAttributesFromExtensions(extensions) {
279
279
  ...defaultAttribute,
280
280
  ...attribute,
281
281
  };
282
- if (attribute.isRequired && attribute.default === undefined) {
282
+ if ((attribute === null || attribute === void 0 ? void 0 : attribute.isRequired) && (attribute === null || attribute === void 0 ? void 0 : attribute.default) === undefined) {
283
283
  delete mergedAttr.default;
284
284
  }
285
285
  extensionAttributes.push({
@@ -545,11 +545,13 @@ function isExtensionRulesEnabled(extension, enabled) {
545
545
 
546
546
  const getTextContentFromNodes = ($from, maxMatch = 500) => {
547
547
  let textBefore = '';
548
- $from.parent.nodesBetween(Math.max(0, $from.parentOffset - maxMatch), $from.parentOffset, (node, pos, parent, index) => {
549
- var _a, _b, _c;
550
- textBefore += ((_b = (_a = node.type.spec).toText) === null || _b === void 0 ? void 0 : _b.call(_a, {
548
+ const sliceEndPos = $from.parentOffset;
549
+ $from.parent.nodesBetween(Math.max(0, sliceEndPos - maxMatch), sliceEndPos, (node, pos, parent, index) => {
550
+ var _a, _b;
551
+ const chunk = ((_b = (_a = node.type.spec).toText) === null || _b === void 0 ? void 0 : _b.call(_a, {
551
552
  node, pos, parent, index,
552
- })) || ((_c = $from.nodeBefore) === null || _c === void 0 ? void 0 : _c.text) || '%leaf%';
553
+ })) || node.textContent || '%leaf%';
554
+ textBefore += chunk.slice(0, Math.max(0, sliceEndPos - pos));
553
555
  });
554
556
  return textBefore;
555
557
  };