mirror of
https://github.com/codex-team/editor.js
synced 2024-06-10 09:52:36 +02:00
* fix scrolling issue caused by the popover.hide() * Update popover.ts * Update CHANGELOG.md * upd codeowners * naming of isShown improved
This commit is contained in:
parent
8ae8823dcd
commit
6a15cc55c0
|
@ -1 +1,2 @@
|
|||
* @neSpecc @gohabereg @khaydarov
|
||||
* @neSpecc @gohabereg @TatianaFomina @ilyamore88
|
||||
|
||||
|
|
|
@ -4,7 +4,9 @@
|
|||
|
||||
- `Fix` — Scrolling issue when opening toolbox on mobile fixed
|
||||
- `Fix` — Typo in toolbox empty placeholder fixed
|
||||
- `Fix` — The issue with scroll jumping on block hovering have fixed [2036](https://github.com/codex-team/editor.js/issues/2036)
|
||||
- `Improvement` — *Dev Example Page* - Add popup example page
|
||||
- `Improvement` — *UI* - The Toolbox will restore the internal scroll on every opening
|
||||
|
||||
### 2.24.1
|
||||
|
||||
|
|
|
@ -58,6 +58,11 @@ export default class Popover extends EventsDispatcher<PopoverEvent> {
|
|||
*/
|
||||
private readonly items: PopoverItem[];
|
||||
|
||||
/**
|
||||
* Stores the visibility state.
|
||||
*/
|
||||
private isShown = false;
|
||||
|
||||
/**
|
||||
* Created nodes
|
||||
*/
|
||||
|
@ -190,6 +195,12 @@ export default class Popover extends EventsDispatcher<PopoverEvent> {
|
|||
* Shows the Popover
|
||||
*/
|
||||
public show(): void {
|
||||
/**
|
||||
* Clear search and items scrolling
|
||||
*/
|
||||
this.search.clear();
|
||||
this.nodes.items.scrollTop = 0;
|
||||
|
||||
this.nodes.popover.classList.add(Popover.CSS.popoverOpened);
|
||||
this.nodes.overlay.classList.remove(Popover.CSS.popoverOverlayHidden);
|
||||
this.flipper.activate();
|
||||
|
@ -203,13 +214,22 @@ export default class Popover extends EventsDispatcher<PopoverEvent> {
|
|||
if (isMobileScreen()) {
|
||||
this.scrollLocker.lock();
|
||||
}
|
||||
|
||||
this.isShown = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides the Popover
|
||||
*/
|
||||
public hide(): void {
|
||||
this.search.clear();
|
||||
/**
|
||||
* If it's already hidden, do nothing
|
||||
* to prevent extra DOM operations
|
||||
*/
|
||||
if (!this.isShown) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.nodes.popover.classList.remove(Popover.CSS.popoverOpened);
|
||||
this.nodes.overlay.classList.add(Popover.CSS.popoverOverlayHidden);
|
||||
this.flipper.deactivate();
|
||||
|
@ -217,6 +237,8 @@ export default class Popover extends EventsDispatcher<PopoverEvent> {
|
|||
if (isMobileScreen()) {
|
||||
this.scrollLocker.unlock();
|
||||
}
|
||||
|
||||
this.isShown = false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue