@tiptap/core 3.10.3 → 3.10.5
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/index.cjs +16 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +16 -19
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/Editor.ts +3 -1
- package/src/helpers/getSchemaByResolvedExtensions.ts +25 -16
package/dist/index.js
CHANGED
|
@@ -1499,6 +1499,17 @@ function cleanUpSchemaItem(data) {
|
|
|
1499
1499
|
})
|
|
1500
1500
|
);
|
|
1501
1501
|
}
|
|
1502
|
+
function buildAttributeSpec(extensionAttribute) {
|
|
1503
|
+
var _a, _b, _c;
|
|
1504
|
+
const spec = {};
|
|
1505
|
+
if (!((_a = extensionAttribute == null ? void 0 : extensionAttribute.attribute) == null ? void 0 : _a.isRequired) && ((_b = extensionAttribute == null ? void 0 : extensionAttribute.attribute) == null ? void 0 : _b.default) !== void 0) {
|
|
1506
|
+
spec.default = extensionAttribute.attribute.default;
|
|
1507
|
+
}
|
|
1508
|
+
if (((_c = extensionAttribute == null ? void 0 : extensionAttribute.attribute) == null ? void 0 : _c.validate) !== void 0) {
|
|
1509
|
+
spec.validate = extensionAttribute.attribute.validate;
|
|
1510
|
+
}
|
|
1511
|
+
return [extensionAttribute.name, spec];
|
|
1512
|
+
}
|
|
1502
1513
|
function getSchemaByResolvedExtensions(extensions, editor) {
|
|
1503
1514
|
var _a;
|
|
1504
1515
|
const allAttributes = getAttributesFromExtensions(extensions);
|
|
@@ -1536,15 +1547,7 @@ function getSchemaByResolvedExtensions(extensions, editor) {
|
|
|
1536
1547
|
),
|
|
1537
1548
|
defining: callOrReturn(getExtensionField(extension, "defining", context)),
|
|
1538
1549
|
isolating: callOrReturn(getExtensionField(extension, "isolating", context)),
|
|
1539
|
-
attrs: Object.fromEntries(
|
|
1540
|
-
extensionAttributes.map((extensionAttribute) => {
|
|
1541
|
-
var _a2, _b;
|
|
1542
|
-
return [
|
|
1543
|
-
extensionAttribute.name,
|
|
1544
|
-
{ default: (_a2 = extensionAttribute == null ? void 0 : extensionAttribute.attribute) == null ? void 0 : _a2.default, validate: (_b = extensionAttribute == null ? void 0 : extensionAttribute.attribute) == null ? void 0 : _b.validate }
|
|
1545
|
-
];
|
|
1546
|
-
})
|
|
1547
|
-
)
|
|
1550
|
+
attrs: Object.fromEntries(extensionAttributes.map(buildAttributeSpec))
|
|
1548
1551
|
});
|
|
1549
1552
|
const parseHTML = callOrReturn(getExtensionField(extension, "parseHTML", context));
|
|
1550
1553
|
if (parseHTML) {
|
|
@@ -1589,15 +1592,7 @@ function getSchemaByResolvedExtensions(extensions, editor) {
|
|
|
1589
1592
|
group: callOrReturn(getExtensionField(extension, "group", context)),
|
|
1590
1593
|
spanning: callOrReturn(getExtensionField(extension, "spanning", context)),
|
|
1591
1594
|
code: callOrReturn(getExtensionField(extension, "code", context)),
|
|
1592
|
-
attrs: Object.fromEntries(
|
|
1593
|
-
extensionAttributes.map((extensionAttribute) => {
|
|
1594
|
-
var _a2, _b;
|
|
1595
|
-
return [
|
|
1596
|
-
extensionAttribute.name,
|
|
1597
|
-
{ default: (_a2 = extensionAttribute == null ? void 0 : extensionAttribute.attribute) == null ? void 0 : _a2.default, validate: (_b = extensionAttribute == null ? void 0 : extensionAttribute.attribute) == null ? void 0 : _b.validate }
|
|
1598
|
-
];
|
|
1599
|
-
})
|
|
1600
|
-
)
|
|
1595
|
+
attrs: Object.fromEntries(extensionAttributes.map(buildAttributeSpec))
|
|
1601
1596
|
});
|
|
1602
1597
|
const parseHTML = callOrReturn(getExtensionField(extension, "parseHTML", context));
|
|
1603
1598
|
if (parseHTML) {
|
|
@@ -4395,7 +4390,9 @@ var Editor = class extends EventEmitter {
|
|
|
4395
4390
|
if (this.isDestroyed) {
|
|
4396
4391
|
return;
|
|
4397
4392
|
}
|
|
4398
|
-
this.
|
|
4393
|
+
if (this.options.autofocus !== false && this.options.autofocus !== null) {
|
|
4394
|
+
this.commands.focus(this.options.autofocus);
|
|
4395
|
+
}
|
|
4399
4396
|
this.emit("create", { editor: this });
|
|
4400
4397
|
this.isInitialized = true;
|
|
4401
4398
|
}, 0);
|