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

New commits:
commit 8fb074b6bf52ed447abedd134d7d12bd1b66fc79
Author:     Szymon Kłos <[email protected]>
AuthorDate: Wed Apr 22 14:58:58 2020 +0200
Commit:     Szymon Kłos <[email protected]>
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 <[email protected]>
    Reviewed-by: Szymon Kłos <[email protected]>

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');
                                }
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to