@tiptap/core 2.0.0-beta.142 → 2.0.0-beta.143
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 +8 -2
- package/dist/tiptap-core.cjs.js.map +1 -1
- package/dist/tiptap-core.esm.js +8 -2
- package/dist/tiptap-core.esm.js.map +1 -1
- package/dist/tiptap-core.umd.js +8 -2
- package/dist/tiptap-core.umd.js.map +1 -1
- package/package.json +2 -2
- package/src/commands/focus.ts +16 -3
package/dist/tiptap-core.esm.js
CHANGED
|
@@ -527,7 +527,11 @@ function resolveSelection(state, position = null) {
|
|
|
527
527
|
to: position,
|
|
528
528
|
};
|
|
529
529
|
}
|
|
530
|
-
const focus = (position = null) => ({ editor, view, tr, dispatch, }) => {
|
|
530
|
+
const focus = (position = null, options) => ({ editor, view, tr, dispatch, }) => {
|
|
531
|
+
options = {
|
|
532
|
+
scrollIntoView: true,
|
|
533
|
+
...options,
|
|
534
|
+
};
|
|
531
535
|
const delayedFocus = () => {
|
|
532
536
|
// focus within `requestAnimationFrame` breaks focus on iOS
|
|
533
537
|
// so we have to call this
|
|
@@ -539,7 +543,9 @@ const focus = (position = null) => ({ editor, view, tr, dispatch, }) => {
|
|
|
539
543
|
requestAnimationFrame(() => {
|
|
540
544
|
if (!editor.isDestroyed) {
|
|
541
545
|
view.focus();
|
|
542
|
-
|
|
546
|
+
if (options === null || options === void 0 ? void 0 : options.scrollIntoView) {
|
|
547
|
+
editor.commands.scrollIntoView();
|
|
548
|
+
}
|
|
543
549
|
}
|
|
544
550
|
});
|
|
545
551
|
};
|