@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.
- 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.umd.js
CHANGED
|
@@ -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
|
-
|
|
543
|
-
|
|
544
|
-
|
|
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
|
-
})) ||
|
|
547
|
+
})) || node.textContent || '%leaf%';
|
|
548
|
+
textBefore += chunk.slice(0, Math.max(0, sliceEndPos - pos));
|
|
547
549
|
});
|
|
548
550
|
return textBefore;
|
|
549
551
|
};
|