MDL-58771 tinymce: emoticon bug

Um - this code is regexing for exact strings generated from the rendering of icons. I'm not going to rewrite anything
to do with tinymce - for now we just make the regexes far less specific.
This commit is contained in:
Damyon Wiese
2017-05-08 12:32:26 +08:00
parent 48ad73619f
commit ae53889d14
@@ -59,22 +59,24 @@
if (o.save) {
tinymce.each(ed.dom.select('img.emoticon', o.node), function(image) {
var emoticontxt = '';
var matches = /^emoticon emoticon-index-([0-9]+)$/.exec(image.className);
if (matches.length != 2) {
// this is not valid emoticon image inserted via dialog
// return true so that each() does not halt
return true;
}
var index = matches[1];
var search = new RegExp('class="emoticon emoticon-index-'.concat(index, '"'));
for (var emotxt in this._emoticons) {
if (search.test(this._emoticons[emotxt])) {
emoticontxt = emotxt;
break;
if (image.classList.contains('emoticon')) {
var matches = /emoticon-index-([0-9]+)/.exec(image.className);
if (!matches) {
// this is not valid emoticon image inserted via dialog
// return true so that each() does not halt
return true;
}
var index = matches[1];
var search = new RegExp('emoticon-index-'.concat(index, '"'));
for (var emotxt in this._emoticons) {
if (search.test(this._emoticons[emotxt])) {
emoticontxt = emotxt;
break;
}
}
if (emoticontxt) {
ed.dom.setOuterHTML(image, emoticontxt);
}
}
if (emoticontxt) {
ed.dom.setOuterHTML(image, emoticontxt);
}
}, this);
}