[Libreoffice-commits] online.git: loleaflet/src
Szymon Kłos (via logerrit)
logerrit at kemper.freedesktop.org
Wed Oct 9 11:33:44 UTC 2019
loleaflet/src/control/Control.JSDialogBuilder.js | 23 +++++++++++++----------
loleaflet/src/control/Control.MobileWizard.js | 6 +++---
2 files changed, 16 insertions(+), 13 deletions(-)
New commits:
commit 3b60a31c06306d1d60f57cf13baa02e445473f36
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Wed Oct 9 12:13:56 2019 +0200
Commit: Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Wed Oct 9 13:33:21 2019 +0200
jsdialogs: fix tabs detection
For each panel we receive panel + window pair in JSON
we need to remove both to have similar case when no merging is
performed. Simplify tabs generation code a bit
Change-Id: Ie0f3d402d1a1e8116f5ee7d1ef72ee5a5349ace9
diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js b/loleaflet/src/control/Control.JSDialogBuilder.js
index 5f192e6a9..f24dfb739 100644
--- a/loleaflet/src/control/Control.JSDialogBuilder.js
+++ b/loleaflet/src/control/Control.JSDialogBuilder.js
@@ -206,7 +206,7 @@ L.Control.JSDialogBuilder = L.Control.extend({
var tabsContainer = L.DomUtil.create('div', 'ui-tabs mobile-wizard ui-widget');
var contentsContainer = L.DomUtil.create('div', 'ui-tabs-content mobile-wizard ui-widget', parentContainer);
- var title1 = builder._cleanText(data.children[1].text);
+ var title1 = builder._cleanText(data[0].text);
var icon1 = builder._createIconPath(title1);
var tab1 = L.DomUtil.create('div', 'ui-tab mobile-wizard', tabsContainer);
@@ -221,8 +221,8 @@ L.Control.JSDialogBuilder = L.Control.extend({
contentDiv.title = title1;
builder._currentDepth++;
- for (var i = 0; i < data.children[1].children[0].children.length; i++) {
- builder.build(contentDiv, [data.children[1].children[0].children[i]]);
+ for (var i = 0; i < data[0].children.length; i++) {
+ builder.build(contentDiv, [data[0].children[i]]);
}
builder._currentDepth--;
@@ -231,7 +231,7 @@ L.Control.JSDialogBuilder = L.Control.extend({
var tab2 = L.DomUtil.create('div', 'ui-tab mobile-wizard', tabsContainer);
- var title2 = builder._cleanText(data.children[3].text);
+ var title2 = builder._cleanText(data[1].text);
var icon2 = builder._createIconPath(title2);
var button2 = L.DomUtil.create('img', 'ui-tab-content mobile-wizard unobutton', tab2);
@@ -244,8 +244,8 @@ L.Control.JSDialogBuilder = L.Control.extend({
contentDiv2.title = title2;
builder._currentDepth++;
- for (i = 0; i < data.children[3].children[0].children.length; i++) {
- builder.build(contentDiv2, [data.children[3].children[0].children[i]]);
+ for (i = 0; i < data[1].children.length; i++) {
+ builder.build(contentDiv2, [data[1].children[i]]);
}
builder._currentDepth--;
@@ -566,13 +566,16 @@ L.Control.JSDialogBuilder = L.Control.extend({
var handler = this._controlHandlers[childType];
- var twoPanelsAsChildren = childData.children && childData.children.length == 5
- && childData.children[1] && childData.children[1].type == 'panel'
- && childData.children[3] && childData.children[3].type == 'panel';
+ var twoPanelsAsChildren = childData.children
+ && (childData.children.length == 4 || childData.children.length == 5)
+ && childData.children[0] && childData.children[0].type == 'panel'
+ && childData.children[2] && childData.children[2].type == 'panel';
if (twoPanelsAsChildren) {
+ var tabsData = [childData.children[0], childData.children[2]];
+
handler = this._controlHandlers['paneltabs'];
- processChildren = handler(childObject, childData, this);
+ processChildren = handler(childObject, tabsData, this);
} else {
if (handler)
processChildren = handler(childObject, childData, this);
diff --git a/loleaflet/src/control/Control.MobileWizard.js b/loleaflet/src/control/Control.MobileWizard.js
index b71a8c93f..039568318 100644
--- a/loleaflet/src/control/Control.MobileWizard.js
+++ b/loleaflet/src/control/Control.MobileWizard.js
@@ -148,8 +148,8 @@ L.Control.MobileWizard = L.Control.extend({
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);
+ var ret = [data.children[i].children[0].children, data.children[i+1].children[0].children];
+ data.children.splice(i, 2);
return ret;
}
@@ -164,7 +164,7 @@ L.Control.MobileWizard = L.Control.extend({
_addChildrenToTextPanel: function (data, children) {
if (data.id === 'SidebarTextPanel') {
- data.children = children.concat(data.children);
+ data.children = children[0].concat(data.children);
return 'success';
}
More information about the Libreoffice-commits
mailing list