mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-04 01:39:37 +01:00
8a402aa701
- Move the TinyMCE plugin CSS to wp-content.css. - Change the replacement images class to `wp-emoji` inside the editor. - Clean up both the plugin and wp-emoji.js, abstract and restructure a bit. See #31242. Built from https://develop.svn.wordpress.org/trunk@31779 git-svn-id: http://core.svn.wordpress.org/trunk@31759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
1 line
900 B
JavaScript
1 line
900 B
JavaScript
!function(a,b){a.PluginManager.add("wpemoji",function(c){var d,e=a.Env.mac&&a.Env.webkit;b&&b.emoji&&(c.on("keydown keyup",function(a){d="keydown"===a.type}),c.on("input setcontent",function(f){var g,h,i,j;d&&"input"===f.type||(g=c.selection,h=g.getNode(),e&&(i=g.getBookmark()),b.emoji.parse(h,{className:"wp-emoji new-emoji"}),j=c.dom.select("img.new-emoji",h),a.each(j,function(a){a.className="wp-emoji",a.setAttribute("data-mce-resize","false"),a.setAttribute("data-mce-placeholder","1"),a.setAttribute("data-wp-emoji",a.alt)}),a.Env.ie&&h&&"BODY"===h.nodeName&&g.collapse(!0),e&&g.moveToBookmark(i))}),c.on("postprocess",function(a){a.content&&(a.content=a.content.replace(/<img[^>]+data-wp-emoji="([^"]+)"[^>]*>/g,function(a,b){return b}))}),c.on("resolvename",function(a){"IMG"===a.target.nodeName&&c.dom.getAttrib(a.target,"data-wp-emoji")&&a.preventDefault()}))})}(window.tinymce,window.wp); |