@@ -265,6 +265,8 @@ export class SideMenuView<BSchema extends BlockSchema> implements PluginView {
265
265
// Makes menu scroll with the page.
266
266
document . addEventListener ( "scroll" , this . onScroll ) ;
267
267
268
+ // Unfreezes the menu whenever the user clicks anywhere.
269
+ document . body . addEventListener ( "mousedown" , this . onMouseDown , true ) ;
268
270
// Hides and unfreezes the menu whenever the user presses a key.
269
271
document . body . addEventListener ( "keydown" , this . onKeyDown , true ) ;
270
272
}
@@ -347,6 +349,14 @@ export class SideMenuView<BSchema extends BlockSchema> implements PluginView {
347
349
this . menuFrozen = false ;
348
350
} ;
349
351
352
+ onMouseDown = ( _event : MouseEvent ) => {
353
+ if ( this . sideMenuState && ! this . sideMenuState . show ) {
354
+ this . sideMenuState . show = true ;
355
+ this . updateSideMenu ( this . sideMenuState ) ;
356
+ }
357
+ this . menuFrozen = false ;
358
+ } ;
359
+
350
360
onMouseMove = ( event : MouseEvent ) => {
351
361
if ( this . menuFrozen ) {
352
362
return ;
@@ -479,6 +489,7 @@ export class SideMenuView<BSchema extends BlockSchema> implements PluginView {
479
489
this . pmView . dom . removeEventListener ( "dragstart" , this . onDragStart ) ;
480
490
document . body . removeEventListener ( "drop" , this . onDrop , true ) ;
481
491
document . removeEventListener ( "scroll" , this . onScroll ) ;
492
+ document . body . removeEventListener ( "mousedown" , this . onMouseDown , true ) ;
482
493
document . body . removeEventListener ( "keydown" , this . onKeyDown , true ) ;
483
494
}
484
495
0 commit comments