Make WordPress Core

Changeset 32142


Ignore:
Timestamp:
04/18/2015 11:28:11 PM (11 years ago)
Author:
azaozz
Message:

TinyMCE: use window.twemoji directly in the wpemoji plugin. Gives a chance to the browser to lazy load twemoji.js when reloading the page.
Fixes #31901.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/js/tinymce/plugins/wpemoji/plugin.js

    r31948 r32142  
    1 ( function( tinymce, wp, twemoji ) {
     1( function( tinymce, wp ) {
    22        tinymce.PluginManager.add( 'wpemoji', function( editor ) {
    33                var typing,
     
    4040                        var selection, bookmark;
    4141
    42                         if ( node && twemoji.test( node.textContent || node.innerText ) ) {
     42                        if ( node && window.twemoji && window.twemoji.test( node.textContent || node.innerText ) ) {
    4343                                if ( env.webkit ) {
    4444                                        selection = editor.selection;
     
    8484                                node = selection.getNode();
    8585
    86                         if ( twemoji.test( node.textContent || node.innerText ) ) {
     86                        if ( window.twemoji && window.twemoji.test( node.textContent || node.innerText ) ) {
    8787                                replaceEmoji( node );
    8888
     
    9797                // Convert Twemoji compatible pasted emoji replacement images into our format.
    9898                editor.on( 'PastePostProcess', function( event ) {
    99                         if ( twemoji ) {
     99                        if ( window.twemoji ) {
    100100                                tinymce.each( editor.dom.$( 'img.emoji', event.node ), function( image ) {
    101                                         if ( image.alt && twemoji.test( image.alt ) ) {
     101                                        if ( image.alt && window.twemoji.test( image.alt ) ) {
    102102                                                setImgAttr( image );
    103103                                        }
     
    126126                } );
    127127        } );
    128 } )( window.tinymce, window.wp, window.twemoji );
     128} )( window.tinymce, window.wp );
Note: See TracChangeset for help on using the changeset viewer.