fix(scroll): acidental scroll to top on iOS devices (#2695)

* fix scroll on ios typing

* Update tsconfig.json

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update package.json

* Fix popover hide method to use isHidden flag
This commit is contained in:
Peter Savchenko 2024-04-27 21:04:26 +03:00 committed by GitHub
parent 844272656e
commit 1028577521
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 17 additions and 6 deletions

View file

@ -1,18 +1,16 @@
# Changelog
### 2.30.1
### 2.30.0
`New` Block Tunes now supports nesting items
`New` Block Tunes now supports separator items
`New` "Convert to" control is now also available in Block Tunes
### 2.30.0
- `Improvement` — The ability to merge blocks of different types (if both tools provide the conversionConfig)
- `Fix``onChange` will be called when removing the entire text within a descendant element of a block.
- `Fix` - Unexpected new line on Enter press with selected block without caret
- `Fix` - Search input autofocus loosing after Block Tunes opening
- `Fix` - Block removing while Enter press on Block Tunes
`Fix` Unwanted scroll on first typing on iOS devices
### 2.29.1

View file

@ -1,6 +1,6 @@
{
"name": "@editorjs/editorjs",
"version": "2.30.0-rc.5",
"version": "2.30.0-rc.6",
"description": "Editor.js — Native JS, based on API and Open Source",
"main": "dist/editorjs.umd.js",
"module": "dist/editorjs.mjs",

View file

@ -30,6 +30,11 @@ export class PopoverMobile extends PopoverAbstract<PopoverMobileNodes> {
*/
private history = new PopoverStatesHistory();
/**
* Flag that indicates if popover is hidden
*/
private isHidden = true;
/**
* Construct the instance
*
@ -58,18 +63,26 @@ export class PopoverMobile extends PopoverAbstract<PopoverMobileNodes> {
super.show();
this.scrollLocker.lock();
this.isHidden = false;
}
/**
* Closes popover
*/
public hide(): void {
if (this.isHidden) {
return;
}
super.hide();
this.nodes.overlay.classList.add(css.overlayHidden);
this.scrollLocker.unlock();
this.history.reset();
this.isHidden = true;
}
/**

View file

@ -15,7 +15,7 @@ export default class ScrollLocker {
/**
* Stores scroll position, used for hard scroll lock
*/
private scrollPosition: null|number;
private scrollPosition: null | number = null;
/**
* Locks body element scroll