Update Twemoji to 1.4.1 including up to 3c0c13d3a5 (exclude SVG elements). Remove our hacks and adapt wp-emoji.js to use the new image attributes callback.

Fixes #32203.

git-svn-id: https://develop.svn.wordpress.org/trunk@32959 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2015-06-26 22:00:13 +00:00
parent d688a2ddc2
commit a0ebf84f40
2 changed files with 95 additions and 40 deletions

File diff suppressed because one or more lines are too long

View File

@ -70,7 +70,7 @@
node = node.parentNode;
}
if ( ! node || node.nodeType !== 1 || ( 'ownerSVGElement' in node ) ||
if ( ! node || node.nodeType !== 1 ||
( node.className && typeof node.className === 'string' && node.className.indexOf( 'wp-exclude-emoji' ) !== -1 ) ) {
continue;
@ -120,6 +120,8 @@
* @param {Object} args Additional options for Twemoji.
*/
function parse( object, args ) {
var params;
if ( ! replaceEmoji || ! twemoji || ! object ||
( 'string' !== typeof object && ( ! object.childNodes || ! object.childNodes.length ) ) ) {
@ -127,12 +129,10 @@
}
args = args || {};
return twemoji.parse( object, {
params = {
base: settings.baseUrl,
ext: settings.ext,
className: args.className || 'emoji',
imgAttr: args.imgAttr,
callback: function( icon, options ) {
// Ignore some standard characters that TinyMCE recommends in its character map.
switch ( icon ) {
@ -155,7 +155,15 @@
return ''.concat( options.base, icon, options.ext );
}
} );
};
if ( typeof args.imgAttr === 'object' ) {
params.attributes = function() {
return args.imgAttr;
};
}
return twemoji.parse( object, params );
}
/**