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

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Tue May 5 18:34:54 UTC 2020


 loleaflet/src/control/Control.JSDialogBuilder.js |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

New commits:
commit 361edbbf6dbcd40e60a32a16973d3aef472b0470
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Mar 24 14:53:35 2020 +0100
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Tue May 5 20:34:36 2020 +0200

    jsdialog: handle treelistbox
    
    Change-Id: I89da1b60591f8a83413b0d25ec75812120ab5f11
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/93465
    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.JSDialogBuilder.js b/loleaflet/src/control/Control.JSDialogBuilder.js
index d96b52d03..4263e6ce1 100644
--- a/loleaflet/src/control/Control.JSDialogBuilder.js
+++ b/loleaflet/src/control/Control.JSDialogBuilder.js
@@ -151,6 +151,7 @@ L.Control.JSDialogBuilder = L.Control.extend({
 		this._controlHandlers['divcontainer'] = this._divContainerHandler;
 		this._controlHandlers['colorlistbox'] = this._colorControl;
 		this._controlHandlers['borderstyle'] = this._borderControl;
+		this._controlHandlers['treelistbox'] = this._listboxControl;
 
 		this._controlHandlers['mainmenu'] = this._containerHandler;
 		this._controlHandlers['submenu'] = this._subMenuHandler;
@@ -1373,14 +1374,17 @@ L.Control.JSDialogBuilder = L.Control.extend({
 
 		var title = data.text;
 		var valueNode = null;
+		var selectedEntryIsString = false;
 		if (data.selectedEntries) {
+			selectedEntryIsString = isNaN(parseInt(data.selectedEntries[0]));
 			if (title && title.length) {
 				var value = data.entries[data.selectedEntries[0]];
 				valueNode = L.DomUtil.create('div', '', null);
 				valueNode.innerHTML = value;
-			} else {
+			} else if (selectedEntryIsString)
+				title = builder._cleanText(data.selectedEntries[0]);
+			else
 				title = data.entries[data.selectedEntries[0]];
-			}
 		}
 		title = builder._cleanText(title);
 		data.text = title;
@@ -1389,6 +1393,7 @@ L.Control.JSDialogBuilder = L.Control.extend({
 		for (var index in data.entries) {
 			var style = 'ui-combobox-text';
 			if ((data.selectedEntries && index == data.selectedEntries[0])
+				|| (data.selectedEntries && selectedEntryIsString && data.entries[index] === data.selectedEntries[0])
 				|| data.entries[index] == title) {
 				style += ' selected';
 			}


More information about the Libreoffice-commits mailing list