fix(move-up-tune): scroll up offset for blocks above viewport (#2298)

* fix: scroll up offset for blocks above viewport

* Update CHANGELOG.md

* Update CHANGELOG.md

---------

Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
This commit is contained in:
Kirk Douglas Jr 2023-03-13 15:09:04 -06:00 committed by GitHub
parent 7bd5c53ab2
commit 9ae96b9e17
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View file

@ -6,6 +6,7 @@
- `Improvement`*Toolbox* — Number of `close()` method calls optimized.
- `Improvement` — The `onChange` callback won't be triggered only if all mutations contain nodes with the `data-mutation-free` attributes.
- `Fix` — Resolve compiler error from importing the BlockToolData type
- `Fix` — Resolved a problem when document was being scrolled to the beginning after moving up a Block above the viewport
### 2.26.5

View file

@ -82,7 +82,7 @@ export default class MoveUpTune implements BlockTune {
if (previousBlockCoords.top > 0) {
scrollUpOffset = Math.abs(currentBlockCoords.top) - Math.abs(previousBlockCoords.top);
} else {
scrollUpOffset = window.innerHeight - Math.abs(currentBlockCoords.top) + Math.abs(previousBlockCoords.top);
scrollUpOffset = Math.abs(currentBlockCoords.top) + previousBlockCoords.height;
}
window.scrollBy(0, -1 * scrollUpOffset);