File tree 1 file changed +15
-1
lines changed
1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -456,6 +456,11 @@ function playpen_text(playpen) {
456
456
// Toggle sidebar
457
457
sidebarToggleButton . addEventListener ( 'click' , function sidebarToggle ( ) {
458
458
if ( html . classList . contains ( "sidebar-hidden" ) ) {
459
+ var current_width = parseInt (
460
+ document . documentElement . style . getPropertyValue ( '--sidebar-width' ) , 10 ) ;
461
+ if ( current_width < 150 ) {
462
+ document . documentElement . style . setProperty ( '--sidebar-width' , '150px' ) ;
463
+ }
459
464
showSidebar ( ) ;
460
465
} else if ( html . classList . contains ( "sidebar-visible" ) ) {
461
466
hideSidebar ( ) ;
@@ -476,7 +481,16 @@ function playpen_text(playpen) {
476
481
html . classList . add ( 'sidebar-resizing' ) ;
477
482
}
478
483
function resize ( e ) {
479
- document . documentElement . style . setProperty ( '--sidebar-width' , ( e . clientX - sidebar . offsetLeft ) + 'px' ) ;
484
+ var pos = ( e . clientX - sidebar . offsetLeft ) ;
485
+ if ( pos < 20 ) {
486
+ hideSidebar ( ) ;
487
+ } else {
488
+ if ( html . classList . contains ( "sidebar-hidden" ) ) {
489
+ showSidebar ( ) ;
490
+ }
491
+ pos = Math . min ( pos , window . innerWidth - 100 ) ;
492
+ document . documentElement . style . setProperty ( '--sidebar-width' , pos + 'px' ) ;
493
+ }
480
494
}
481
495
//on mouseup remove windows functions mousemove & mouseup
482
496
function stopResize ( e ) {
You can’t perform that action at this time.
0 commit comments