Skip to content

Commit bf0ff0c

Browse files
Wqrldnperez0111
andauthored
fix(core): call scrollIntoView() on Enter (#2802)
Co-authored-by: Nick Perez <computers@nickthesick.com> Signed-off-by: Wqrld <wereld03@gmail.com>
1 parent 571cb93 commit bf0ff0c

3 files changed

Lines changed: 4 additions & 1 deletion

File tree

packages/core/src/blocks/utils/listItemEnterHandler.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ export const handleEnter = (
3434
} else if (blockContent.node.childCount > 0) {
3535
return editor.transact((tr) => {
3636
tr.deleteSelection();
37+
tr.scrollIntoView();
3738
return splitBlockTr(tr, tr.selection.from, true);
38-
});
39+
});
3940
}
4041

4142
return false;

packages/core/src/editor/BlockNoteEditor.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,7 @@ export class BlockNoteEditor<
498498
autofocus: newOptions.autofocus ?? false,
499499
extensions: tiptapExtensions,
500500
editorProps: {
501+
scrollMargin: { top: 72, bottom: 72, left: 0, right: 0 },
501502
...newOptions._tiptapOptions?.editorProps,
502503
attributes: {
503504
// As of TipTap v2.5.0 the tabIndex is removed when the editor is not

packages/core/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -920,6 +920,7 @@ export const KeyboardShortcutsExtension = Extension.create<{
920920
selectionAtBlockStart,
921921
),
922922
)
923+
.scrollIntoView()
923924
.run();
924925

925926
return true;

0 commit comments

Comments
 (0)