@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.esm.js
CHANGED
|
@@ -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
|
-
|
|
545
|
-
|
|
546
|
-
|
|
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
|
-
})) ||
|
|
549
|
+
})) || node.textContent || '%leaf%';
|
|
550
|
+
textBefore += chunk.slice(0, Math.max(0, sliceEndPos - pos));
|
|
549
551
|
});
|
|
550
552
|
return textBefore;
|
|
551
553
|
};
|