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