@@ -52,7 +52,7 @@ class="fixed inset-0 z-40 opacity-50 bg-light-base-50 dark:bg-base-900"
5252
5353 <div
5454 class =" fixed inset-0 z-20 opacity-50 bg-light-base-50 dark:bg-base-900"
55- x-show =" (isLeftPanelOpen || isRightPanelOpen) && isSmallDevice ()"
55+ x-show =" (isLeftPanelOpen || isRightPanelOpen) && isNotExtraLargeDevice ()"
5656 @click =" closePanels"
5757 x-transition:enter =" ease-out duration-300"
5858 x-transition:leave =" ease-in duration-200"
@@ -260,9 +260,12 @@ class="text-primary-400 dark:text-primary-500 hover:text-primary-300 dark:hover:
260260@script
261261 <script >
262262 Alpine .data (' vault' , () => ({
263+ defaultLeftPanelOpen: Alpine .$persist (true ),
264+ defaultRightPanelOpen: Alpine .$persist (true ),
263265 isLeftPanelOpen: false ,
264266 isRightPanelOpen: false ,
265267 isContentWidthFull: Alpine .$persist (false ),
268+ showToggleContentWidthButton: false ,
266269 recentFiles: $wire .entangle (' recentFiles' ),
267270 isEditingMarkdown: Alpine .$persist (false ),
268271 isEditMode: Alpine .$persist (true ),
@@ -291,8 +294,8 @@ class="text-primary-400 dark:text-primary-500 hover:text-primary-300 dark:hover:
291294 });
292295 }
293296
294- this .isLeftPanelOpen = ! this . isSmallDevice ();
295- this . isRightPanelOpen = ! this .isSmallDevice ();
297+ this .handleResponsiveLayout ();
298+ window . onresize = () => this .handleResponsiveLayout ();
296299
297300 Echo .private (' User.{{ auth ()-> user ()-> id } }' )
298301 .listen (' CollaborationDeletedEvent' , (e ) => {
@@ -322,15 +325,38 @@ class="text-primary-400 dark:text-primary-500 hover:text-primary-300 dark:hover:
322325 });
323326 },
324327
325- isSmallDevice () {
328+ isMediumDevice () {
329+ return window .innerWidth > 768 ;
330+ },
331+
332+ isNotExtraLargeDevice () {
326333 return window .innerWidth < 1280 ;
327334 },
328335
336+ handleResponsiveLayout () {
337+ if (this .isNotExtraLargeDevice ()) {
338+ this .closePanels ();
339+ } else {
340+ this .isLeftPanelOpen = this .defaultLeftPanelOpen ;
341+ this .isRightPanelOpen = this .defaultRightPanelOpen ;
342+ }
343+
344+ this .showToggleContentWidthButton = this .isMediumDevice ();
345+ },
346+
329347 toggleLeftPanel () {
348+ if (! this .isNotExtraLargeDevice ()) {
349+ this .defaultLeftPanelOpen = ! this .defaultLeftPanelOpen ;
350+ }
351+
330352 this .isLeftPanelOpen = ! this .isLeftPanelOpen ;
331353 },
332354
333355 toggleRightPanel () {
356+ if (! this .isNotExtraLargeDevice ()) {
357+ this .defaultRightPanelOpen = ! this .defaultRightPanelOpen ;
358+ }
359+
334360 this .isRightPanelOpen = ! this .isRightPanelOpen ;
335361 },
336362
@@ -366,7 +392,7 @@ class="text-primary-400 dark:text-primary-500 hover:text-primary-300 dark:hover:
366392
367393 $wire .openFileId (fileId, autofocus);
368394
369- if (this .isSmallDevice ()) {
395+ if (this .isNotExtraLargeDevice ()) {
370396 this .closePanels ();
371397 }
372398 },
0 commit comments