From f76e4990ed37d798be765129bc74de972da56a0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tam=C3=A1s=20Zolnai?= Date: Mon, 16 Dec 2019 14:55:15 +0100 Subject: [PATCH] Revert "Context menus: Better to handle missing icon automatically." MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit fb12f822699274c9c1d8a249d199ecc892070938. With this method the "missing image" icon is displayed for a moment, before removing it from the screen. Change-Id: I360279244bccddb23eadca485e571d6ac514d865 Reviewed-on: https://gerrit.libreoffice.org/85224 Tested-by: Jenkins CollaboraOffice Reviewed-by: Tamás Zolnai --- loleaflet/src/control/Control.JSDialogBuilder.js | 9 ++------- loleaflet/src/core/LOUtil.js | 5 ++++- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js b/loleaflet/src/control/Control.JSDialogBuilder.js index 9145f2bcb..4b993e790 100644 --- a/loleaflet/src/control/Control.JSDialogBuilder.js +++ b/loleaflet/src/control/Control.JSDialogBuilder.js @@ -1420,20 +1420,15 @@ L.Control.JSDialogBuilder = L.Control.extend({ var iconPath = 'images/lc_' + commandName.toLowerCase() + '.svg'; icon = L.DomUtil.create('img', '', iconSpan); icon.src = iconPath; - icon.onerror = function() { - L.DomUtil.removeClass(iconSpan.nextSibling, 'menu-entry-with-icon'); - L.DomUtil.addClass(iconSpan.nextSibling, 'menu-entry-no-icon'); - L.DomUtil.remove(iconSpan); - } } - if (data.checked && data.checked === true) { L.DomUtil.addClass(menuEntry, 'menu-entry-checked'); } var titleSpan = L.DomUtil.create('span', '', menuEntry); titleSpan.innerHTML = title; - L.DomUtil.addClass(titleSpan, 'menu-entry-with-icon'); + var paddingClass = icon ? 'menu-entry-with-icon' : 'menu-entry-no-icon'; + L.DomUtil.addClass(titleSpan, paddingClass); if (builder.wizard) { $(menuEntry).click(function() { diff --git a/loleaflet/src/core/LOUtil.js b/loleaflet/src/core/LOUtil.js index 0172c1058..95252882d 100644 --- a/loleaflet/src/core/LOUtil.js +++ b/loleaflet/src/core/LOUtil.js @@ -97,7 +97,8 @@ L.LOUtil = { 'InsertZWSP', 'InsertZWNBSP', 'InsertLRM', - 'InsertRLM' + 'InsertRLM', + 'None' ], existsIconForCommand: function(command) { @@ -105,6 +106,8 @@ L.LOUtil = { var res = !this.commandWithoutIcon.find(function (el) { return el.startsWith(commandName); }); + if (commandName.indexOf('?')!== -1) + return false; return res; } };