From 21adb61bc98aa913a773d3305fd51eb4bb42c2bf Mon Sep 17 00:00:00 2001 From: Tomoyuki Hata Date: Fri, 19 Feb 2021 00:48:05 +0900 Subject: [PATCH] Scroll Window with block selection (#1457) * Scroll Window with block selection * Update CHANGELOG.md Co-authored-by: Peter Savchenko --- docs/CHANGELOG.md | 2 +- src/components/modules/crossBlockSelection.ts | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index c042a276..09908483 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -5,6 +5,7 @@ - `Improvements` - A generic type for Tool config added [#1516](https://github.com/codex-team/editor.js/issues/1516) - `Improvements` - Remove unused `force` option in `Caret.navigateNext()` and `Caret.navigatePrevious()` [#857](https://github.com/codex-team/editor.js/issues/857#issuecomment-770363438). - `Improvements` - Remove bundles from the repo [#1541](https://github.com/codex-team/editor.js/pull/1541). +- `Improvements` - Document will be scrolled when blocks are selected with `SHIFT+UP` or `SHIFT+DOWN` [#1447](https://github.com/codex-team/editor.js/issues/1447) - `Fix` - Fix BlockManager.setCurrentBlockByChildNode() with multiple Editor.js instances [#1503](https://github.com/codex-team/editor.js/issues/1503). - `Fix` - Type definition of the Sanitizer config: the sanitize function now contains param definition [#1491](https://github.com/codex-team/editor.js/pull/1491). @@ -19,7 +20,6 @@ - `Fix` - Sanitize pasted block data [#1396](https://github.com/codex-team/editor.js/issues/1396). - `Fix` - Unnecessary block creation after arrow navigation at last non-default block[#1414](https://github.com/codex-team/editor.js/issues/1414) - ### 2.19 - `New` - Read-only mode 🥳 [#837](https://github.com/codex-team/editor.js/issues/837) diff --git a/src/components/modules/crossBlockSelection.ts b/src/components/modules/crossBlockSelection.ts index 2aa64861..76d31c67 100644 --- a/src/components/modules/crossBlockSelection.ts +++ b/src/components/modules/crossBlockSelection.ts @@ -98,6 +98,10 @@ export default class CrossBlockSelection extends Module { /** close InlineToolbar when Blocks selected */ this.Editor.InlineToolbar.close(); + + nextBlock.holder.scrollIntoView({ + block: 'nearest', + }); } /**