@tiptap/core 2.5.0-beta.3 → 2.5.0-beta.4

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
@@ -466,6 +466,7 @@ function getSchemaByResolvedExtensions(extensions, editor) {
466
466
  selectable: callOrReturn(getExtensionField(extension, 'selectable', context)),
467
467
  draggable: callOrReturn(getExtensionField(extension, 'draggable', context)),
468
468
  code: callOrReturn(getExtensionField(extension, 'code', context)),
469
+ whitespace: callOrReturn(getExtensionField(extension, 'whitespace', context)),
469
470
  defining: callOrReturn(getExtensionField(extension, 'defining', context)),
470
471
  isolating: callOrReturn(getExtensionField(extension, 'isolating', context)),
471
472
  attrs: Object.fromEntries(extensionAttributes.map(extensionAttribute => {
@@ -1083,7 +1084,7 @@ class ExtensionManager {
1083
1084
  const addKeyboardShortcuts = getExtensionField(extension, 'addKeyboardShortcuts', context);
1084
1085
  let defaultBindings = {};
1085
1086
  // bind exit handling
1086
- if (extension.type === 'mark' && extension.config.exitable) {
1087
+ if (extension.type === 'mark' && getExtensionField(extension, 'exitable', context)) {
1087
1088
  defaultBindings.ArrowRight = () => Mark.handleExit({ editor, mark: extension });
1088
1089
  }
1089
1090
  if (addKeyboardShortcuts) {
@@ -1289,13 +1290,17 @@ class Extension {
1289
1290
  configure(options = {}) {
1290
1291
  // return a new instance so we can use the same extension
1291
1292
  // with different calls of `configure`
1292
- const extension = this.extend();
1293
+ const extension = this.extend({
1294
+ ...this.config,
1295
+ addOptions() {
1296
+ var _a;
1297
+ return mergeDeep(((_a = this.parent) === null || _a === void 0 ? void 0 : _a.call(this)) || {}, options);
1298
+ },
1299
+ });
1300
+ // Always preserve the current name
1301
+ extension.name = this.name;
1302
+ // Set the parent to be our parent
1293
1303
  extension.parent = this.parent;
1294
- extension.options = mergeDeep(this.options, options);
1295
- extension.storage = callOrReturn(getExtensionField(extension, 'addStorage', {
1296
- name: extension.name,
1297
- options: extension.options,
1298
- }));
1299
1304
  return extension;
1300
1305
  }
1301
1306
  extend(extendedConfig = {}) {
@@ -1303,7 +1308,7 @@ class Extension {
1303
1308
  extension.parent = this;
1304
1309
  this.child = extension;
1305
1310
  extension.name = extendedConfig.name ? extendedConfig.name : extension.parent.name;
1306
- if (extendedConfig.defaultOptions) {
1311
+ if (extendedConfig.defaultOptions && Object.keys(extendedConfig.defaultOptions).length > 0) {
1307
1312
  console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`);
1308
1313
  }
1309
1314
  extension.options = callOrReturn(getExtensionField(extension, 'addOptions', {
@@ -3641,7 +3646,7 @@ const Tabindex = Extension.create({
3641
3646
  new state.Plugin({
3642
3647
  key: new state.PluginKey('tabindex'),
3643
3648
  props: {
3644
- attributes: this.editor.isEditable ? { tabindex: '0' } : {},
3649
+ attributes: () => (this.editor.isEditable ? { tabindex: '0' } : {}),
3645
3650
  },
3646
3651
  }),
3647
3652
  ];
@@ -4556,20 +4561,25 @@ class Mark {
4556
4561
  configure(options = {}) {
4557
4562
  // return a new instance so we can use the same extension
4558
4563
  // with different calls of `configure`
4559
- const extension = this.extend();
4560
- extension.options = mergeDeep(this.options, options);
4561
- extension.storage = callOrReturn(getExtensionField(extension, 'addStorage', {
4562
- name: extension.name,
4563
- options: extension.options,
4564
- }));
4564
+ const extension = this.extend({
4565
+ ...this.config,
4566
+ addOptions() {
4567
+ var _a;
4568
+ return mergeDeep(((_a = this.parent) === null || _a === void 0 ? void 0 : _a.call(this)) || {}, options);
4569
+ },
4570
+ });
4571
+ // Always preserve the current name
4572
+ extension.name = this.name;
4573
+ // Set the parent to be our parent
4574
+ extension.parent = this.parent;
4565
4575
  return extension;
4566
4576
  }
4567
4577
  extend(extendedConfig = {}) {
4568
- const extension = new Mark({ ...this.config, ...extendedConfig });
4578
+ const extension = new Mark(extendedConfig);
4569
4579
  extension.parent = this;
4570
4580
  this.child = extension;
4571
4581
  extension.name = extendedConfig.name ? extendedConfig.name : extension.parent.name;
4572
- if (extendedConfig.defaultOptions) {
4582
+ if (extendedConfig.defaultOptions && Object.keys(extendedConfig.defaultOptions).length > 0) {
4573
4583
  console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`);
4574
4584
  }
4575
4585
  extension.options = callOrReturn(getExtensionField(extension, 'addOptions', {
@@ -4643,20 +4653,25 @@ class Node {
4643
4653
  configure(options = {}) {
4644
4654
  // return a new instance so we can use the same extension
4645
4655
  // with different calls of `configure`
4646
- const extension = this.extend();
4647
- extension.options = mergeDeep(this.options, options);
4648
- extension.storage = callOrReturn(getExtensionField(extension, 'addStorage', {
4649
- name: extension.name,
4650
- options: extension.options,
4651
- }));
4656
+ const extension = this.extend({
4657
+ ...this.config,
4658
+ addOptions() {
4659
+ var _a;
4660
+ return mergeDeep(((_a = this.parent) === null || _a === void 0 ? void 0 : _a.call(this)) || {}, options);
4661
+ },
4662
+ });
4663
+ // Always preserve the current name
4664
+ extension.name = this.name;
4665
+ // Set the parent to be our parent
4666
+ extension.parent = this.parent;
4652
4667
  return extension;
4653
4668
  }
4654
4669
  extend(extendedConfig = {}) {
4655
- const extension = new Node({ ...this.config, ...extendedConfig });
4670
+ const extension = new Node(extendedConfig);
4656
4671
  extension.parent = this;
4657
4672
  this.child = extension;
4658
4673
  extension.name = extendedConfig.name ? extendedConfig.name : extension.parent.name;
4659
- if (extendedConfig.defaultOptions) {
4674
+ if (extendedConfig.defaultOptions && Object.keys(extendedConfig.defaultOptions).length > 0) {
4660
4675
  console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`);
4661
4676
  }
4662
4677
  extension.options = callOrReturn(getExtensionField(extension, 'addOptions', {