From bd306e3dbe3425b5e9884a66599ce0fc342bcfe2 Mon Sep 17 00:00:00 2001 From: Aron Budea Date: Thu, 26 Oct 2017 15:35:19 +0200 Subject: [PATCH] loleaflet: make char preview work in Special Characters dialog Previously loading animation was shown if the user clicked below the glyph. Change-Id: Ic13eb06139a352e47db8db85ae2948e0fbab282c Reviewed-on: https://gerrit.libreoffice.org/43895 Reviewed-by: Henry Castro Tested-by: Henry Castro --- loleaflet/src/control/Control.CharacterMap.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/loleaflet/src/control/Control.CharacterMap.js b/loleaflet/src/control/Control.CharacterMap.js index 7646475d6..8d7fe6a4b 100644 --- a/loleaflet/src/control/Control.CharacterMap.js +++ b/loleaflet/src/control/Control.CharacterMap.js @@ -480,9 +480,18 @@ L.Control.CharacterMap = L.Control.extend({ _onSymbolClick: function (e) { var target = e.target || e.srcElement; + var realData; + if (typeof target.data !== 'undefined') + { + realData = target.data; + } + else if (target.childElementCount > 0) + { + realData = target.childNodes[0].data; + } var encodedFont = window.encodeURIComponent(this._fontNames.options[this._fontNames.selectedIndex].value); - var encodedChar = window.encodeURIComponent(String.fromCharCode(target.data)); - this._hexa.data = target.data; + var encodedChar = window.encodeURIComponent(String.fromCharCode(realData)); + this._hexa.data = realData; if (this.cacheGlyph[encodedFont + encodedChar]) { this._preview.src = this.cacheGlyph[encodedFont + encodedChar].src; } else {