[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-1-0' - 3 commits - loleaflet/dist loleaflet/src

Henry Castro hcastro at collabora.com
Wed May 18 10:19:52 UTC 2016


 loleaflet/dist/toolbar/toolbar.js |    7 ++++---
 loleaflet/src/core/Socket.js      |   17 +++++++++++++++--
 2 files changed, 19 insertions(+), 5 deletions(-)

New commits:
commit 1f61e89a4bfa548f84be6f4de773e12cee93465b
Author: Henry Castro <hcastro at collabora.com>
Date:   Tue May 17 12:23:00 2016 -0400

    loleaflet: fix "Maximum call stack size exceeded"
    
    (cherry picked from commit c511cc9fca8f1c650ab7104c4e2ca00a76bf38b8)

diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index 606e137..bbd68e2 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -100,6 +100,14 @@ L.Socket = L.Class.extend({
 		this._map._activate();
 	},
 
+	_utf8ToString: function (data) {
+		var strBytes = '';
+		for (var it = 0; it < data.length; it++) {
+			strBytes += String.fromCharCode(data[it]);
+		}
+		return strBytes;
+	},
+
 	_onMessage: function (e) {
 		var imgBytes, index, textMsg;
 
@@ -177,8 +185,13 @@ L.Socket = L.Class.extend({
 			// log the tile msg separately as we need the tile coordinates
 			L.Log.log(textMsg, L.INCOMING);
 			if (imgBytes !== undefined) {
-				// if it's not a tile, parse the whole message
-				textMsg = String.fromCharCode.apply(null, imgBytes);
+				try {
+					// if it's not a tile, parse the whole message
+					textMsg = String.fromCharCode.apply(null, imgBytes);
+				} catch (error) {
+					// big data string
+					textMsg = this._utf8ToString(imgBytes);
+				}
 			}
 			// Decode UTF-8.
 			textMsg = decodeURIComponent(window.escape(textMsg));
commit aa9d5f105d37f0f0b975a975b8829fad1d901065
Author: Pranav Kant <pranavk at collabora.com>
Date:   Fri May 13 17:07:08 2016 +0530

    loleaflet: command was an undefined variable
    
    ... which leads to a JS error making font size list box not
    workable sometimes.
    
    Change-Id: I7452960c05a655ebdf48e3170987c29a37a7c2a6
    (cherry picked from commit 37145f9969cc5f109ff3e9ab77d0e0b9fbdf2bb1)

diff --git a/loleaflet/dist/toolbar/toolbar.js b/loleaflet/dist/toolbar/toolbar.js
index 596d032..7b4ea33 100644
--- a/loleaflet/dist/toolbar/toolbar.js
+++ b/loleaflet/dist/toolbar/toolbar.js
@@ -496,10 +496,11 @@ function onFontSelect (e) {
 
 function onFontSizeSelect (e) {
 	var size = e.target.value;
+	var command = {};
 	$(e.target).find('option[data-select2-tag]').removeAttr('data-select2-tag');
 	map.applyFontSize(size);
-		fontcolor = map.getDocType() === 'text' ? 'FontColor' : 'Color';
-		command[fontcolor] = {};
+	fontcolor = map.getDocType() === 'text' ? 'FontColor' : 'Color';
+	command[fontcolor] = {};
 	map.focus();
 }
 
commit 1d432b34f24172232a551a712b84ddfb153ab029
Author: Pranav Kant <pranavk at collabora.com>
Date:   Fri May 13 16:42:39 2016 +0530

    loleaflet: Fix incorrect variable access
    
    Change-Id: I11981c002808257d39aea70a632039a40839397b
    (cherry picked from commit 1a918d878104950032e3727b1fe9329ca841c914)

diff --git a/loleaflet/dist/toolbar/toolbar.js b/loleaflet/dist/toolbar/toolbar.js
index 20eab86..596d032 100644
--- a/loleaflet/dist/toolbar/toolbar.js
+++ b/loleaflet/dist/toolbar/toolbar.js
@@ -704,7 +704,7 @@ map.on('commandstatechanged', function (e) {
 			else if (state === 'false') {
 				toolbar.uncheck(id);
 			}
-			else if (state === 'enabled' && map._docLayer._permission === 'edit') {
+			else if (state === 'enabled' && map._permission === 'edit') {
 				toolbar.enable(id);
 			}
 			else if (state === 'disabled') {


More information about the Libreoffice-commits mailing list