@tiptap/core 2.0.0-beta.142 → 2.0.0-beta.146

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.
@@ -11,8 +11,9 @@ function getType(value) {
11
11
  return Object.prototype.toString.call(value).slice(8, -1);
12
12
  }
13
13
  function isPlainObject(value) {
14
- if (getType(value) !== 'Object')
14
+ if (getType(value) !== 'Object') {
15
15
  return false;
16
+ }
16
17
  return value.constructor === Object && Object.getPrototypeOf(value) === Object.prototype;
17
18
  }
18
19
 
@@ -127,15 +128,9 @@ class Extension {
127
128
  if (extendedConfig.defaultOptions) {
128
129
  console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`);
129
130
  }
130
- // TODO: remove `addOptions` fallback
131
- extension.options = extendedConfig.defaultOptions
132
- ? extendedConfig.defaultOptions
133
- : extension.parent.options;
134
- if (extendedConfig.addOptions) {
135
- extension.options = callOrReturn(getExtensionField(extension, 'addOptions', {
136
- name: extension.name,
137
- }));
138
- }
131
+ extension.options = callOrReturn(getExtensionField(extension, 'addOptions', {
132
+ name: extension.name,
133
+ }));
139
134
  extension.storage = callOrReturn(getExtensionField(extension, 'addStorage', {
140
135
  name: extension.name,
141
136
  options: extension.options,
@@ -527,7 +522,11 @@ function resolveSelection(state, position = null) {
527
522
  to: position,
528
523
  };
529
524
  }
530
- const focus = (position = null) => ({ editor, view, tr, dispatch, }) => {
525
+ const focus = (position = null, options) => ({ editor, view, tr, dispatch, }) => {
526
+ options = {
527
+ scrollIntoView: true,
528
+ ...options,
529
+ };
531
530
  const delayedFocus = () => {
532
531
  // focus within `requestAnimationFrame` breaks focus on iOS
533
532
  // so we have to call this
@@ -539,7 +538,9 @@ const focus = (position = null) => ({ editor, view, tr, dispatch, }) => {
539
538
  requestAnimationFrame(() => {
540
539
  if (!editor.isDestroyed) {
541
540
  view.focus();
542
- editor.commands.scrollIntoView();
541
+ if (options === null || options === void 0 ? void 0 : options.scrollIntoView) {
542
+ editor.commands.scrollIntoView();
543
+ }
543
544
  }
544
545
  });
545
546
  };
@@ -3417,15 +3418,9 @@ class Node {
3417
3418
  if (extendedConfig.defaultOptions) {
3418
3419
  console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`);
3419
3420
  }
3420
- // TODO: remove `addOptions` fallback
3421
- extension.options = extendedConfig.defaultOptions
3422
- ? extendedConfig.defaultOptions
3423
- : extension.parent.options;
3424
- if (extendedConfig.addOptions) {
3425
- extension.options = callOrReturn(getExtensionField(extension, 'addOptions', {
3426
- name: extension.name,
3427
- }));
3428
- }
3421
+ extension.options = callOrReturn(getExtensionField(extension, 'addOptions', {
3422
+ name: extension.name,
3423
+ }));
3429
3424
  extension.storage = callOrReturn(getExtensionField(extension, 'addStorage', {
3430
3425
  name: extension.name,
3431
3426
  options: extension.options,
@@ -3488,15 +3483,9 @@ class Mark {
3488
3483
  if (extendedConfig.defaultOptions) {
3489
3484
  console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`);
3490
3485
  }
3491
- // TODO: remove `addOptions` fallback
3492
- extension.options = extendedConfig.defaultOptions
3493
- ? extendedConfig.defaultOptions
3494
- : extension.parent.options;
3495
- if (extendedConfig.addOptions) {
3496
- extension.options = callOrReturn(getExtensionField(extension, 'addOptions', {
3497
- name: extension.name,
3498
- }));
3499
- }
3486
+ extension.options = callOrReturn(getExtensionField(extension, 'addOptions', {
3487
+ name: extension.name,
3488
+ }));
3500
3489
  extension.storage = callOrReturn(getExtensionField(extension, 'addStorage', {
3501
3490
  name: extension.name,
3502
3491
  options: extension.options,