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

Marco Cecchetti (via logerrit) logerrit at kemper.freedesktop.org
Tue Oct 8 20:28:52 UTC 2019


 loleaflet/src/control/Control.JSDialogBuilder.js |    2 +-
 loleaflet/src/core/LOUtil.js                     |   20 ++++++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)

New commits:
commit 04a8d9f31838f924eb9319d1da20714a486ae222
Author:     Marco Cecchetti <marco.cecchetti at collabora.com>
AuthorDate: Tue Oct 8 21:55:01 2019 +0200
Commit:     Marco Cecchetti <marco.cecchetti at collabora.com>
CommitDate: Tue Oct 8 21:55:17 2019 +0200

    loleaflet: avoid to show broken icon in the mobile wizard
    
    Change-Id: Ib3626b6a7ccac996c5da98a8cb3ced5d7f9af7a2

diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js b/loleaflet/src/control/Control.JSDialogBuilder.js
index ce3342452..dc4d04b34 100644
--- a/loleaflet/src/control/Control.JSDialogBuilder.js
+++ b/loleaflet/src/control/Control.JSDialogBuilder.js
@@ -514,7 +514,7 @@ L.Control.JSDialogBuilder = L.Control.extend({
 
 		var icon = null;
 		var commandName = data.command ? data.command.substring('.uno:'.length) : data.id;
-		if (commandName && commandName.length) {
+		if (commandName && commandName.length && L.LOUtil.existsIconForCommand(commandName)) {
 			var iconSpan = L.DomUtil.create('span', 'menu-entry-icon', menuEntry);
 			var iconPath = 'images/lc_' + commandName.toLowerCase() + '.svg';
 			icon = L.DomUtil.create('img', '', iconSpan);
diff --git a/loleaflet/src/core/LOUtil.js b/loleaflet/src/core/LOUtil.js
index 27025f3a9..0172c1058 100644
--- a/loleaflet/src/core/LOUtil.js
+++ b/loleaflet/src/core/LOUtil.js
@@ -86,5 +86,25 @@ L.LOUtil = {
 	generateNewFileName: function(oldFileName, suffix) {
 		var idx = oldFileName.lastIndexOf('.');
 		return oldFileName.substring(0, idx) + suffix + oldFileName.substring(idx);
+	},
+
+	commandWithoutIcon: [
+		'InsertPageHeader',
+		'InsertPageFooter',
+		'InsertNonBreakingSpace',
+		'InsertHardHyphen',
+		'InsertSoftHyphen',
+		'InsertZWSP',
+		'InsertZWNBSP',
+		'InsertLRM',
+		'InsertRLM'
+	],
+
+	existsIconForCommand: function(command) {
+		var commandName = command.startsWith('.uno:') ? command.substring('.uno:'.length) : command;
+		var res = !this.commandWithoutIcon.find(function (el) {
+			return el.startsWith(commandName);
+		});
+		return res;
 	}
 };


More information about the Libreoffice-commits mailing list