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