diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2022-04-22 14:26:58 +0200 |
---|---|---|
committer | Szymon Kłos <eszkadev@gmail.com> | 2022-04-22 15:14:04 +0200 |
commit | ca57bb5b07ea9a81744584e47eeda5dc78478c05 (patch) | |
tree | dbc4eb39987c890a2d6b931d3a0444d5c69ac006 | |
parent | Fix overflow for main-nav on UI mode swotch (diff) | |
download | online-ca57bb5b07ea9a81744584e47eeda5dc78478c05.tar.gz online-ca57bb5b07ea9a81744584e47eeda5dc78478c05.zip |
notebookbar: be sure it is initialized early
Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: I2820a09a478538d93512a760a9fb9ca0bcb8d49f
-rw-r--r-- | browser/src/control/Control.Notebookbar.js | 1 | ||||
-rw-r--r-- | browser/src/control/Control.NotebookbarWriter.js | 13 | ||||
-rw-r--r-- | browser/src/control/Control.UIManager.js | 30 | ||||
-rw-r--r-- | browser/src/control/Toolbar.js | 3 |
4 files changed, 15 insertions, 32 deletions
diff --git a/browser/src/control/Control.Notebookbar.js b/browser/src/control/Control.Notebookbar.js index e34ce3ddc4..9d4904b3ca 100644 --- a/browser/src/control/Control.Notebookbar.js +++ b/browser/src/control/Control.Notebookbar.js @@ -49,6 +49,7 @@ L.Control.Notebookbar = L.Control.extend({ this.map.on('statusbarchanged', this.onStatusbarChange, this); this.map.on('rulerchanged', this.onRulerChange, this); + this.map.sendUnoCommand('.uno:ToolbarMode?Mode:string=notebookbar_online.ui'); $('#toolbar-wrapper').addClass('hasnotebookbar'); $('.main-nav').addClass('hasnotebookbar'); diff --git a/browser/src/control/Control.NotebookbarWriter.js b/browser/src/control/Control.NotebookbarWriter.js index 52be815e21..20011f648a 100644 --- a/browser/src/control/Control.NotebookbarWriter.js +++ b/browser/src/control/Control.NotebookbarWriter.js @@ -595,18 +595,7 @@ L.Control.NotebookbarWriter = L.Control.Notebookbar.extend({ { 'id': 'stylesview', 'type': 'iconview', - 'entries': [ - { - 'text': _('Default Style'), - 'selected': 'true' - }, - { - 'text': _('Text Body'), - }, - { - 'text': _('Title'), - } - ], + 'entries': [], 'vertical': 'false' }, { diff --git a/browser/src/control/Control.UIManager.js b/browser/src/control/Control.UIManager.js index c3bd6d7410..d77a47bf18 100644 --- a/browser/src/control/Control.UIManager.js +++ b/browser/src/control/Control.UIManager.js @@ -145,19 +145,7 @@ L.Control.UIManager = L.Control.extend({ this.map.addControl(L.control.mobileTopBar(docType)); this.map.addControl(L.control.searchBar()); } else if (enableNotebookbar) { - if (docType === 'spreadsheet') { - var notebookbar = L.control.notebookbarCalc(); - } else if (docType === 'presentation') { - notebookbar = L.control.notebookbarImpress(); - } else if (docType === 'drawing') { - notebookbar = L.control.notebookbarDraw(); - } else { - notebookbar = L.control.notebookbarWriter(); - } - - this.notebookbar = notebookbar; - this.map.addControl(notebookbar); - + this.createNotebookbarControl(docType); // makeSpaceForNotebookbar call in onUpdatePermission } @@ -256,12 +244,12 @@ L.Control.UIManager = L.Control.extend({ this.map.topToolbar.updateControlsState(); }, - addNotebookbarUI: function() { - if (this.map.getDocType() === 'spreadsheet') { + createNotebookbarControl: function(docType) { + if (docType === 'spreadsheet') { var notebookbar = L.control.notebookbarCalc(); - } else if (this.map.getDocType() === 'presentation') { + } else if (docType === 'presentation') { notebookbar = L.control.notebookbarImpress(); - } else if (this.map.getDocType() === 'drawing') { + } else if (docType === 'drawing') { notebookbar = L.control.notebookbarDraw(); } else { notebookbar = L.control.notebookbarWriter(); @@ -269,9 +257,13 @@ L.Control.UIManager = L.Control.extend({ this.notebookbar = notebookbar; this.map.addControl(notebookbar); + }, + + addNotebookbarUI: function() { + this.createNotebookbarControl(this.map.getDocType()); - notebookbar._showNotebookbar = true; - notebookbar.showTabs(); + this.notebookbar._showNotebookbar = true; + this.notebookbar.showTabs(); $('.main-nav').removeClass('readonly'); $('#map').addClass('notebookbar-opened'); diff --git a/browser/src/control/Toolbar.js b/browser/src/control/Toolbar.js index c05b0f9563..d8ed1e279b 100644 --- a/browser/src/control/Toolbar.js +++ b/browser/src/control/Toolbar.js @@ -328,7 +328,8 @@ L.Map.include({ var isAllowedInReadOnly = false; var allowedCommands = ['.uno:Save', '.uno:WordCountDialog', '.uno:EditAnnotation', '.uno:InsertAnnotation', '.uno:DeleteAnnotation', '.uno:Signature', - '.uno:ShowResolvedAnnotations']; + '.uno:ShowResolvedAnnotations', '.uno:ToolbarMode?Mode:string=notebookbar_online.ui', + '.uno:ToolbarMode?Mode:string=Default']; for (var i in allowedCommands) { if (allowedCommands[i] === command) { |