@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.
- package/dist/packages/core/src/commands/focus.d.ts +3 -1
- package/dist/tiptap-core.cjs.js +19 -30
- package/dist/tiptap-core.cjs.js.map +1 -1
- package/dist/tiptap-core.esm.js +19 -30
- package/dist/tiptap-core.esm.js.map +1 -1
- package/dist/tiptap-core.umd.js +19 -30
- package/dist/tiptap-core.umd.js.map +1 -1
- package/package.json +4 -4
- package/src/Extension.ts +7 -14
- package/src/Mark.ts +7 -14
- package/src/Node.ts +7 -14
- package/src/commands/focus.ts +16 -3
- package/src/utilities/isPlainObject.ts +4 -1
package/dist/tiptap-core.cjs.js
CHANGED
|
@@ -15,8 +15,9 @@ function getType(value) {
|
|
|
15
15
|
return Object.prototype.toString.call(value).slice(8, -1);
|
|
16
16
|
}
|
|
17
17
|
function isPlainObject(value) {
|
|
18
|
-
if (getType(value) !== 'Object')
|
|
18
|
+
if (getType(value) !== 'Object') {
|
|
19
19
|
return false;
|
|
20
|
+
}
|
|
20
21
|
return value.constructor === Object && Object.getPrototypeOf(value) === Object.prototype;
|
|
21
22
|
}
|
|
22
23
|
|
|
@@ -131,15 +132,9 @@ class Extension {
|
|
|
131
132
|
if (extendedConfig.defaultOptions) {
|
|
132
133
|
console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`);
|
|
133
134
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
: extension.parent.options;
|
|
138
|
-
if (extendedConfig.addOptions) {
|
|
139
|
-
extension.options = callOrReturn(getExtensionField(extension, 'addOptions', {
|
|
140
|
-
name: extension.name,
|
|
141
|
-
}));
|
|
142
|
-
}
|
|
135
|
+
extension.options = callOrReturn(getExtensionField(extension, 'addOptions', {
|
|
136
|
+
name: extension.name,
|
|
137
|
+
}));
|
|
143
138
|
extension.storage = callOrReturn(getExtensionField(extension, 'addStorage', {
|
|
144
139
|
name: extension.name,
|
|
145
140
|
options: extension.options,
|
|
@@ -531,7 +526,11 @@ function resolveSelection(state, position = null) {
|
|
|
531
526
|
to: position,
|
|
532
527
|
};
|
|
533
528
|
}
|
|
534
|
-
const focus = (position = null) => ({ editor, view, tr, dispatch, }) => {
|
|
529
|
+
const focus = (position = null, options) => ({ editor, view, tr, dispatch, }) => {
|
|
530
|
+
options = {
|
|
531
|
+
scrollIntoView: true,
|
|
532
|
+
...options,
|
|
533
|
+
};
|
|
535
534
|
const delayedFocus = () => {
|
|
536
535
|
// focus within `requestAnimationFrame` breaks focus on iOS
|
|
537
536
|
// so we have to call this
|
|
@@ -543,7 +542,9 @@ const focus = (position = null) => ({ editor, view, tr, dispatch, }) => {
|
|
|
543
542
|
requestAnimationFrame(() => {
|
|
544
543
|
if (!editor.isDestroyed) {
|
|
545
544
|
view.focus();
|
|
546
|
-
|
|
545
|
+
if (options === null || options === void 0 ? void 0 : options.scrollIntoView) {
|
|
546
|
+
editor.commands.scrollIntoView();
|
|
547
|
+
}
|
|
547
548
|
}
|
|
548
549
|
});
|
|
549
550
|
};
|
|
@@ -3421,15 +3422,9 @@ class Node {
|
|
|
3421
3422
|
if (extendedConfig.defaultOptions) {
|
|
3422
3423
|
console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`);
|
|
3423
3424
|
}
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
: extension.parent.options;
|
|
3428
|
-
if (extendedConfig.addOptions) {
|
|
3429
|
-
extension.options = callOrReturn(getExtensionField(extension, 'addOptions', {
|
|
3430
|
-
name: extension.name,
|
|
3431
|
-
}));
|
|
3432
|
-
}
|
|
3425
|
+
extension.options = callOrReturn(getExtensionField(extension, 'addOptions', {
|
|
3426
|
+
name: extension.name,
|
|
3427
|
+
}));
|
|
3433
3428
|
extension.storage = callOrReturn(getExtensionField(extension, 'addStorage', {
|
|
3434
3429
|
name: extension.name,
|
|
3435
3430
|
options: extension.options,
|
|
@@ -3492,15 +3487,9 @@ class Mark {
|
|
|
3492
3487
|
if (extendedConfig.defaultOptions) {
|
|
3493
3488
|
console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`);
|
|
3494
3489
|
}
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
: extension.parent.options;
|
|
3499
|
-
if (extendedConfig.addOptions) {
|
|
3500
|
-
extension.options = callOrReturn(getExtensionField(extension, 'addOptions', {
|
|
3501
|
-
name: extension.name,
|
|
3502
|
-
}));
|
|
3503
|
-
}
|
|
3490
|
+
extension.options = callOrReturn(getExtensionField(extension, 'addOptions', {
|
|
3491
|
+
name: extension.name,
|
|
3492
|
+
}));
|
|
3504
3493
|
extension.storage = callOrReturn(getExtensionField(extension, 'addStorage', {
|
|
3505
3494
|
name: extension.name,
|
|
3506
3495
|
options: extension.options,
|