File tree 3 files changed +27
-2
lines changed 3 files changed +27
-2
lines changed Original file line number Diff line number Diff line change 1
- * @ neSpecc @ gohabereg @ khaydarov
1
+ * @ neSpecc @ gohabereg @ TatianaFomina @ ilyamore88
2
+
Original file line number Diff line number Diff line change 4
4
5
5
- ` Fix ` — Scrolling issue when opening toolbox on mobile fixed
6
6
- ` Fix ` — Typo in toolbox empty placeholder fixed
7
+ - ` Fix ` — The issue with scroll jumping on block hovering have fixed [ 2036] ( https://github.com/codex-team/editor.js/issues/2036 )
7
8
- ` Improvement ` — * Dev Example Page* - Add popup example page
9
+ - ` Improvement ` — * UI* - The Toolbox will restore the internal scroll on every opening
8
10
9
11
### 2.24.1
10
12
Original file line number Diff line number Diff line change @@ -58,6 +58,11 @@ export default class Popover extends EventsDispatcher<PopoverEvent> {
58
58
*/
59
59
private readonly items : PopoverItem [ ] ;
60
60
61
+ /**
62
+ * Stores the visibility state.
63
+ */
64
+ private isShown = false ;
65
+
61
66
/**
62
67
* Created nodes
63
68
*/
@@ -190,6 +195,12 @@ export default class Popover extends EventsDispatcher<PopoverEvent> {
190
195
* Shows the Popover
191
196
*/
192
197
public show ( ) : void {
198
+ /**
199
+ * Clear search and items scrolling
200
+ */
201
+ this . search . clear ( ) ;
202
+ this . nodes . items . scrollTop = 0 ;
203
+
193
204
this . nodes . popover . classList . add ( Popover . CSS . popoverOpened ) ;
194
205
this . nodes . overlay . classList . remove ( Popover . CSS . popoverOverlayHidden ) ;
195
206
this . flipper . activate ( ) ;
@@ -203,20 +214,31 @@ export default class Popover extends EventsDispatcher<PopoverEvent> {
203
214
if ( isMobileScreen ( ) ) {
204
215
this . scrollLocker . lock ( ) ;
205
216
}
217
+
218
+ this . isShown = true ;
206
219
}
207
220
208
221
/**
209
222
* Hides the Popover
210
223
*/
211
224
public hide ( ) : void {
212
- this . search . clear ( ) ;
225
+ /**
226
+ * If it's already hidden, do nothing
227
+ * to prevent extra DOM operations
228
+ */
229
+ if ( ! this . isShown ) {
230
+ return ;
231
+ }
232
+
213
233
this . nodes . popover . classList . remove ( Popover . CSS . popoverOpened ) ;
214
234
this . nodes . overlay . classList . add ( Popover . CSS . popoverOverlayHidden ) ;
215
235
this . flipper . deactivate ( ) ;
216
236
217
237
if ( isMobileScreen ( ) ) {
218
238
this . scrollLocker . unlock ( ) ;
219
239
}
240
+
241
+ this . isShown = false ;
220
242
}
221
243
222
244
/**
You can’t perform that action at this time.
0 commit comments