@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.
@@ -5,7 +5,9 @@ declare module '@tiptap/core' {
5
5
  /**
6
6
  * Focus the editor at the given position.
7
7
  */
8
- focus: (position?: FocusPosition) => ReturnType;
8
+ focus: (position?: FocusPosition, options?: {
9
+ scrollIntoView?: boolean;
10
+ }) => ReturnType;
9
11
  };
10
12
  }
11
13
  }
@@ -531,7 +531,11 @@ function resolveSelection(state, position = null) {
531
531
  to: position,
532
532
  };
533
533
  }
534
- const focus = (position = null) => ({ editor, view, tr, dispatch, }) => {
534
+ const focus = (position = null, options) => ({ editor, view, tr, dispatch, }) => {
535
+ options = {
536
+ scrollIntoView: true,
537
+ ...options,
538
+ };
535
539
  const delayedFocus = () => {
536
540
  // focus within `requestAnimationFrame` breaks focus on iOS
537
541
  // so we have to call this
@@ -543,7 +547,9 @@ const focus = (position = null) => ({ editor, view, tr, dispatch, }) => {
543
547
  requestAnimationFrame(() => {
544
548
  if (!editor.isDestroyed) {
545
549
  view.focus();
546
- editor.commands.scrollIntoView();
550
+ if (options === null || options === void 0 ? void 0 : options.scrollIntoView) {
551
+ editor.commands.scrollIntoView();
552
+ }
547
553
  }
548
554
  });
549
555
  };