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

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Fri May 1 10:59:35 UTC 2020


 loleaflet/src/control/Control.NotebookbarBuilder.js |   25 ++++++++++----------
 1 file changed, 13 insertions(+), 12 deletions(-)

New commits:
commit 8fb074b6bf52ed447abedd134d7d12bd1b66fc79
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Wed Apr 22 14:58:58 2020 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Fri May 1 12:59:17 2020 +0200

    notebookbar: build also vertical containers
    
    Change-Id: Ifb7d964cf524767243efa850fb236186a3f2924f
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/93256
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/loleaflet/src/control/Control.NotebookbarBuilder.js b/loleaflet/src/control/Control.NotebookbarBuilder.js
index 810f86074..4d26d0e7a 100644
--- a/loleaflet/src/control/Control.NotebookbarBuilder.js
+++ b/loleaflet/src/control/Control.NotebookbarBuilder.js
@@ -10,35 +10,36 @@ L.Control.NotebookbarBuilder = L.Control.JSDialogBuilder.extend({
 		this.map = map;
 	},
 
-	build: function(parent, data) {
+	build: function(parent, data, hasVerticalParent) {
 		this._amendJSDialogData(data);
 
-		if (data.length > 1) {
-			var table = L.DomUtil.create('table', '', parent);
-			var tr = L.DomUtil.create('tr', '', table);
-		} else {
-			tr = parent;
-		}
+		var containerToInsert = parent;
 
 		for (var childIndex in data) {
 			var childData = data[childIndex];
 			if (!childData)
 				continue;
 
-			var td = (data.length > 1) ? L.DomUtil.create('td', '', tr) : tr;
+			if (!hasVerticalParent)
+				var td = L.DomUtil.create('td', '', containerToInsert);
+			else {
+				containerToInsert = L.DomUtil.create('tr', '', parent);
+				td = L.DomUtil.create('td', '', containerToInsert);
+			}
+
+			var isVertical = childData.vertical === 'true' ? true : false;
 
 			this._parentize(childData);
 			var childType = childData.type;
 			var processChildren = true;
-			var needsToCreateContainer =
-				childType == 'panel' || childType == 'frame';
 
 			if ((childData.id === undefined || childData.id === '' || childData.id === null)
 				&& (childType == 'checkbox' || childType == 'radiobutton')) {
 				continue;
 			}
 
-			var childObject = needsToCreateContainer ? L.DomUtil.createWithId('div', childData.id, td) : td;
+			var table = L.DomUtil.create('table', '', td);
+			var childObject = L.DomUtil.create('tr', '', table);
 
 			var handler = this._controlHandlers[childType];
 			var twoPanelsAsChildren =
@@ -56,7 +57,7 @@ L.Control.NotebookbarBuilder = L.Control.JSDialogBuilder.extend({
 					console.warn('Unsupported control type: \"' + childType + '\"');
 
 				if (processChildren && childData.children != undefined)
-					this.build(childObject, childData.children);
+					this.build(childObject, childData.children, isVertical);
 				else if (childData.visible && (childData.visible === false || childData.visible === 'false')) {
 					$('#' + childData.id).addClass('hidden-from-event');
 				}


More information about the Libreoffice-commits mailing list