@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 CHANGED
@@ -1627,6 +1627,17 @@ function cleanUpSchemaItem(data) {
1627
1627
  })
1628
1628
  );
1629
1629
  }
1630
+ function buildAttributeSpec(extensionAttribute) {
1631
+ var _a, _b, _c;
1632
+ const spec = {};
1633
+ 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) {
1634
+ spec.default = extensionAttribute.attribute.default;
1635
+ }
1636
+ if (((_c = extensionAttribute == null ? void 0 : extensionAttribute.attribute) == null ? void 0 : _c.validate) !== void 0) {
1637
+ spec.validate = extensionAttribute.attribute.validate;
1638
+ }
1639
+ return [extensionAttribute.name, spec];
1640
+ }
1630
1641
  function getSchemaByResolvedExtensions(extensions, editor) {
1631
1642
  var _a;
1632
1643
  const allAttributes = getAttributesFromExtensions(extensions);
@@ -1664,15 +1675,7 @@ function getSchemaByResolvedExtensions(extensions, editor) {
1664
1675
  ),
1665
1676
  defining: callOrReturn(getExtensionField(extension, "defining", context)),
1666
1677
  isolating: callOrReturn(getExtensionField(extension, "isolating", context)),
1667
- attrs: Object.fromEntries(
1668
- extensionAttributes.map((extensionAttribute) => {
1669
- var _a2, _b;
1670
- return [
1671
- extensionAttribute.name,
1672
- { 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 }
1673
- ];
1674
- })
1675
- )
1678
+ attrs: Object.fromEntries(extensionAttributes.map(buildAttributeSpec))
1676
1679
  });
1677
1680
  const parseHTML = callOrReturn(getExtensionField(extension, "parseHTML", context));
1678
1681
  if (parseHTML) {
@@ -1717,15 +1720,7 @@ function getSchemaByResolvedExtensions(extensions, editor) {
1717
1720
  group: callOrReturn(getExtensionField(extension, "group", context)),
1718
1721
  spanning: callOrReturn(getExtensionField(extension, "spanning", context)),
1719
1722
  code: callOrReturn(getExtensionField(extension, "code", context)),
1720
- attrs: Object.fromEntries(
1721
- extensionAttributes.map((extensionAttribute) => {
1722
- var _a2, _b;
1723
- return [
1724
- extensionAttribute.name,
1725
- { 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 }
1726
- ];
1727
- })
1728
- )
1723
+ attrs: Object.fromEntries(extensionAttributes.map(buildAttributeSpec))
1729
1724
  });
1730
1725
  const parseHTML = callOrReturn(getExtensionField(extension, "parseHTML", context));
1731
1726
  if (parseHTML) {
@@ -4523,7 +4518,9 @@ var Editor = class extends EventEmitter {
4523
4518
  if (this.isDestroyed) {
4524
4519
  return;
4525
4520
  }
4526
- this.commands.focus(this.options.autofocus);
4521
+ if (this.options.autofocus !== false && this.options.autofocus !== null) {
4522
+ this.commands.focus(this.options.autofocus);
4523
+ }
4527
4524
  this.emit("create", { editor: this });
4528
4525
  this.isInitialized = true;
4529
4526
  }, 0);