loleaflet/src/control/Control.UIManager.js |   16 ++++++++++++++++
 loleaflet/src/map/Map.js                   |   10 ----------
 2 files changed, 16 insertions(+), 10 deletions(-)

New commits:
commit 9b8e6dbbf90a5ba565c729a55db621e81567dc97
Author:     Henry Castro <hcas...@collabora.com>
AuthorDate: Thu Jul 9 11:17:08 2020 -0400
Commit:     Henry Castro <hcas...@collabora.com>
CommitDate: Fri Jul 10 20:39:54 2020 +0200

    loleaflet: simplify removing unused elements
    
    Move the code to the corresponding UI manager
    initialization.
    
    Change-Id: I68162f1a6ebb40b2bfbe85508173d9283a411f97
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98444
    Tested-by: Jenkins
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Henry Castro <hcas...@collabora.com>

diff --git a/loleaflet/src/control/Control.UIManager.js 
b/loleaflet/src/control/Control.UIManager.js
index 4a6bb927b..534216d73 100644
--- a/loleaflet/src/control/Control.UIManager.js
+++ b/loleaflet/src/control/Control.UIManager.js
@@ -87,6 +87,22 @@ L.Control.UIManager = L.Control.extend({
                if (docType === 'spreadsheet') {
                        
this.map.addControl(L.control.sheetsBar({shownavigation: isDesktop || 
window.mode.isTablet()}));
                        this.map.addControl(L.control.formulaBar());
+
+                       // remove unused elements
+                       
L.DomUtil.remove(L.DomUtil.get('presentation-controls-wrapper'));
+               }
+
+               if (docType === 'presentation') {
+                       // remove unused elements
+                       
L.DomUtil.remove(L.DomUtil.get('spreadsheet-row-column-frame'));
+                       L.DomUtil.remove(L.DomUtil.get('spreadsheet-toolbar'));
+               }
+
+               if (docType === 'text') {
+                       // remove unused elements
+                       
L.DomUtil.remove(L.DomUtil.get('spreadsheet-row-column-frame'));
+                       L.DomUtil.remove(L.DomUtil.get('spreadsheet-toolbar'));
+                       
L.DomUtil.remove(L.DomUtil.get('presentation-controls-wrapper'));
                }
 
                if (docType === 'presentation' && (isDesktop || 
window.mode.isTablet())) {
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 2d4dd2b0e..b94489a9f 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -203,16 +203,6 @@ L.Map = L.Evented.extend({
                                var interactiveRuler = this._permission === 
'edit' ? true : false;
                                L.control.ruler({position:'topleft', 
interactive:interactiveRuler}).addTo(this);
                        }
-                       if (this._docLayer._docType === 'text') {
-                               
L.DomUtil.remove(L.DomUtil.get('spreadsheet-row-column-frame'));
-                               
L.DomUtil.remove(L.DomUtil.get('spreadsheet-toolbar'));
-                               
L.DomUtil.remove(L.DomUtil.get('presentation-controls-wrapper'));
-                       } else if (this._docLayer._docType === 'presentation') {
-                               
L.DomUtil.remove(L.DomUtil.get('spreadsheet-row-column-frame'));
-                               
L.DomUtil.remove(L.DomUtil.get('spreadsheet-toolbar'));
-                       } else if (this._docLayer._docType === 'spreadsheet') {
-                               
L.DomUtil.remove(L.DomUtil.get('presentation-controls-wrapper'));
-                       }
 
                        // We need core's knowledge of whether it is a mobile 
phone
                        // or not to be in sync with the test in _onJSDialogMsg 
in TileLayer.js.
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to