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

Mihai Varga mihai.varga at collabora.com
Mon Jul 13 08:04:52 PDT 2015


 loleaflet/src/control/Buttons.js         |    6 ++++--
 loleaflet/src/control/Control.Buttons.js |   10 +---------
 2 files changed, 5 insertions(+), 11 deletions(-)

New commits:
commit c23aa66e54b5cfbd2dd049853e62ab4f72a92579
Author: Mihai Varga <mihai.varga at collabora.com>
Date:   Mon Jul 13 18:01:42 2015 +0300

    loleaflet: don't toggle buttons on click

diff --git a/loleaflet/src/control/Control.Buttons.js b/loleaflet/src/control/Control.Buttons.js
index 1115004..1663f3c 100644
--- a/loleaflet/src/control/Control.Buttons.js
+++ b/loleaflet/src/control/Control.Buttons.js
@@ -51,14 +51,6 @@ L.Control.Buttons = L.Control.extend({
 	_onButtonClick: function (e) {
 		var id = e.target.id;
 		var button = this._buttons[id];
-		if (button.active) {
-			L.DomUtil.removeClass(e.target, 'leaflet-control-buttons-active');
-			button.active = false;
-		}
-		else {
-			L.DomUtil.addClass(e.target, 'leaflet-control-buttons-active');
-			button.active = true;
-		}
 		this._map.toggleCommandState(button.uno);
 	},
 
commit 3bd2e8f778e04c36401b8a95ed88f2d1e230c20f
Author: Mihai Varga <mihai.varga at collabora.com>
Date:   Mon Jul 13 17:08:48 2015 +0300

    loleaflet: renamed toggleState to toggleCommandState

diff --git a/loleaflet/src/control/Buttons.js b/loleaflet/src/control/Buttons.js
index 2d7e806..07a37e2 100644
--- a/loleaflet/src/control/Buttons.js
+++ b/loleaflet/src/control/Buttons.js
@@ -2,7 +2,9 @@
  * Toolbar buttons handler
  */
 L.Map.include({
-	toggleState: function (unoState) {
-		this.socket.send('uno .uno:' + unoState);
+	toggleCommandState: function (unoState) {
+		if (this._docLayer._permission === 'edit') {
+			this.socket.send('uno .uno:' + unoState);
+		}
 	}
 });
diff --git a/loleaflet/src/control/Control.Buttons.js b/loleaflet/src/control/Control.Buttons.js
index d4a08c2..1115004 100644
--- a/loleaflet/src/control/Control.Buttons.js
+++ b/loleaflet/src/control/Control.Buttons.js
@@ -59,7 +59,7 @@ L.Control.Buttons = L.Control.extend({
 			L.DomUtil.addClass(e.target, 'leaflet-control-buttons-active');
 			button.active = true;
 		}
-		this._map.toggleState(button.uno);
+		this._map.toggleCommandState(button.uno);
 	},
 
 	_onStateChange: function (e) {


More information about the Libreoffice-commits mailing list