mirror of
https://github.com/codex-team/editor.js
synced 2024-06-10 09:52:36 +02:00
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:
parent
7bd5c53ab2
commit
9ae96b9e17
|
@ -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
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue