Prevent hiding the menu bar in tabbed mode

Tabbed mode doesn't have a menu bar, instead it has tabs. These can't be
hidden. Unfortunately, the post messages to hide the menu bar have the
side effect of hiding the tabs. This commit prevents the tabs being
hidden when in tabbed mode, and shows the tabs again when switching from
compact mode into tabbed mode.

When switching back from tabbed into compact mode, the state that you
would like the menu bar to be in (hidden/shown) will be remembered and
restored. This includes any postmessages that were not acted on while in
tabbed mode.

Signed-off-by: Skyler Grey <skyler.grey@collabora.com>
Change-Id: I1177903fe965e354538e6e7bbc3c83af3177938e
This commit is contained in:
Skyler Grey 2023-11-14 13:10:01 +00:00 committed by Skyler
parent 3185307c7a
commit 02d64f19d9

View file

@ -429,6 +429,9 @@ L.Control.UIManager = L.Control.extend({
this.map._docLayer._requestNewTiles();
this.map.topToolbar.updateControlsState();
if (this._menubarShouldBeHidden)
this.hideMenubar();
},
createNotebookbarControl: function(docType) {
@ -496,6 +499,9 @@ L.Control.UIManager = L.Control.extend({
this.refreshNotebookbar();
this.map._docLayer._resetClientVisArea();
this.map._docLayer._requestNewTiles();
var menubarWasHidden = this.isMenubarHidden();
this.showMenubar();
this._menubarShouldBeHidden = menubarWasHidden;
},
removeNotebookbarUI: function() {
@ -663,6 +669,7 @@ L.Control.UIManager = L.Control.extend({
// Menubar
showMenubar: function() {
this._menubarShouldBeHidden = false;
if (!this.isMenubarHidden())
return;
$('.main-nav').show();
@ -680,7 +687,8 @@ L.Control.UIManager = L.Control.extend({
},
hideMenubar: function() {
if (this.isMenubarHidden())
this._menubarShouldBeHidden = true;
if (this.isMenubarHidden() || this.shouldUseNotebookbarMode())
return;
var notebookbarWasCollapsed = this.isNotebookbarCollapsed();