@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.
- package/dist/tiptap-core.cjs.js +7 -5
- package/dist/tiptap-core.cjs.js.map +1 -1
- package/dist/tiptap-core.esm.js +7 -5
- package/dist/tiptap-core.esm.js.map +1 -1
- package/dist/tiptap-core.umd.js +7 -5
- package/dist/tiptap-core.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/helpers/getAttributesFromExtensions.ts +1 -1
- package/src/helpers/getTextContentFromNodes.ts +8 -4
package/dist/tiptap-core.cjs.js
CHANGED
|
@@ -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
|
-
|
|
549
|
-
|
|
550
|
-
|
|
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
|
-
})) ||
|
|
553
|
+
})) || node.textContent || '%leaf%';
|
|
554
|
+
textBefore += chunk.slice(0, Math.max(0, sliceEndPos - pos));
|
|
553
555
|
});
|
|
554
556
|
return textBefore;
|
|
555
557
|
};
|