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 <hcastro@collabora.com>
Tested-by: Henry Castro <hcastro@collabora.com>
This commit is contained in:
Aron Budea 2017-10-26 15:35:19 +02:00 committed by Henry Castro
parent a3d6dee503
commit bd306e3dbe

View file

@ -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 {