[Libreoffice-commits] online.git: loleaflet/dist loleaflet/src

Pranav Kant pranavk at collabora.co.uk
Mon Dec 12 08:47:26 UTC 2016


 loleaflet/dist/toolbar/toolbar.js |   13 ++++++++++++-
 loleaflet/src/map/Map.js          |    8 +++-----
 2 files changed, 15 insertions(+), 6 deletions(-)

New commits:
commit fda2f26df4dbd33541192b4df7dc69a799fee38d
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Mon Dec 12 13:49:04 2016 +0530

    loleaflet: Don't use w2ui directly from loleaflet
    
    Use events, 'hidebusy', 'showbusy' to interact with toolbar.
    In some cases, it may happen that w2ui usage in loleaflet happens
    before browser loads w2ui.js (as it is in <script> tag after the
    one which loads loleaflet).
    
    Change-Id: I9b1b249ede72ed01f97cf31fd3f93780312530bc

diff --git a/loleaflet/dist/toolbar/toolbar.js b/loleaflet/dist/toolbar/toolbar.js
index ffd5639..8db30ae 100644
--- a/loleaflet/dist/toolbar/toolbar.js
+++ b/loleaflet/dist/toolbar/toolbar.js
@@ -2,7 +2,7 @@
  * LibreOffice Online toolbar
  */
 
-/* global $ map closebutton w2ui vex _ */
+/* global $ map closebutton w2ui w2utils vex _ */
 
 function onDelete(e) {
 	if (e !== false) {
@@ -727,6 +727,17 @@ function onFormulaBarBlur() {
 	}, 250);
 }
 
+map.on('hidebusy', function() {
+	// If locked, unlock
+	if (w2ui['toolbar-down'].box.firstChild.className === 'w2ui-lock') {
+		w2utils.unlock(w2ui['toolbar-down'].box);
+	}
+});
+
+map.on('showbusy', function(e) {
+	w2utils.lock(w2ui['toolbar-down'].box, e.label, true);
+});
+
 map.on('wopiprops', function(e) {
 	if (e.HideSaveOption) {
 		w2ui['toolbar-up'].hide('save');
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 682f246..b53c2d7 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -2,7 +2,7 @@
  * L.Map is the central class of the API - it is used to create a map.
  */
 
-/* global vex $ w2ui w2utils */
+/* global vex $ */
 L.Map = L.Evented.extend({
 
 	options: {
@@ -156,7 +156,7 @@ L.Map = L.Evented.extend({
 		// If document is already loaded, ask the toolbar widget to show busy
 		// status on the bottom statusbar
 		if (this._docLayer) {
-			w2utils.lock(w2ui['toolbar-down'].box, label, true);
+			this.fire('showbusy', {label: label});
 			return;
 		}
 
@@ -170,9 +170,7 @@ L.Map = L.Evented.extend({
 	},
 
 	hideBusy: function () {
-		if (w2ui['toolbar-down'].box.firstChild.className === 'w2ui-lock') {
-			w2utils.unlock(w2ui['toolbar-down'].box);
-		}
+		this.fire('hidebusy');
 
 		if (this.hasLayer(this._progressBar)) {
 			this.removeLayer(this._progressBar);


More information about the Libreoffice-commits mailing list