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

Tamás Zolnai (via logerrit) logerrit at kemper.freedesktop.org
Tue Oct 8 11:47:57 UTC 2019


 loleaflet/src/layer/tile/TileLayer.js |   42 ++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

New commits:
commit d30533d204705d187ced4778873332ba0e43e2e7
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Tue Oct 8 13:30:03 2019 +0200
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Tue Oct 8 13:30:09 2019 +0200

    mobile: Merge Style and Text Properties panels in mobile wizard
    
    Change-Id: I5f15f1da4ab157bb77220311bcb2744f72ae3b72

diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 1609b9ed0..eeadda445 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -756,10 +756,52 @@ L.TileLayer = L.GridLayer.extend({
 	_onJSDialogMsg: function (textMsg) {
 		if (window.mode.isMobile() && window.mobileWizard === true) {
 			var msgData = JSON.parse(textMsg.substring('jsdialog:'.length + 1));
+			this._mergeStylesAndTextPropertyPanels(msgData);
 			this._openMobileWizard(msgData);
 		}
 	},
 
+	_mergeStylesAndTextPropertyPanels: function (data) {
+		var stylesChildren = this._removeStylesPanelAndGetContent(data);
+		this._addChildrenToTextPanel(data, stylesChildren);
+	},
+
+	_removeStylesPanelAndGetContent: function (data) {
+		if (data.children) {
+			for (var i = 0; i < data.children.length; i++) {
+				if (data.children[i].type === 'panel' && data.children[i].children &&
+					data.children[i].children.length > 0 && data.children[i].children[0].id === 'SidebarStylesPanel') {
+					var ret = data.children[i].children[0].children;
+					data.children.splice(i, 1);
+					return ret;
+				}
+
+				var childReturn = this._removeStylesPanelAndGetContent(data.children[i]);
+				if (childReturn !== null) {
+					return childReturn;
+				}
+			}
+		}
+		return null;
+	},
+
+	_addChildrenToTextPanel: function (data, children) {
+		if (data.id === 'SidebarTextPanel') {
+			data.children = children.concat(data.children);
+			return 'success';
+		}
+
+		if (data.children) {
+			for (var i = 0; i < data.children.length; i++) {
+				var childReturn = this._addChildrenToTextPanel(data.children[i], children);
+				if (childReturn !== null) {
+					return childReturn;
+				}
+			}
+		}
+		return null;
+	},
+
 	_onGraphicSelectionMsg: function (textMsg) {
 		if (textMsg.match('EMPTY')) {
 			this._resetSelectionRanges();


More information about the Libreoffice-commits mailing list