Make WordPress Core

Changeset 26983


Ignore:
Timestamp:
01/19/2014 11:21:07 PM (11 years ago)
Author:
azaozz
Message:

TinyMCE: add a custom jQuery event 'tinymce-editor-init' triggered on initialization of every editor instance. This makes it a lot more convenient to hook into the instance compared to the init.setup callback. See #24067, see #26872.

File:
1 edited

Legend:

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

    r26941 r26983  
    311311            }
    312312        });
     313
     314        if ( typeof window.jQuery !== 'undefined' ) {
     315            window.jQuery( document ).triggerHandler( 'tinymce-editor-init', [editor] );
     316        }
    313317    });
    314318
    315319    // Word count
    316     if ( typeof jQuery !== 'undefined' ) {
     320    if ( typeof window.jQuery !== 'undefined' ) {
    317321        editor.on( 'keyup', function( e ) {
    318322            var key = e.keyCode || e.charCode;
     
    323327
    324328            if ( 13 === key || 8 === last || 46 === last ) {
    325                 jQuery(document).triggerHandler( 'wpcountwords', [ editor.getContent({ format : 'raw' }) ] );
     329                window.jQuery( document ).triggerHandler( 'wpcountwords', [ editor.getContent({ format : 'raw' }) ] );
    326330            }
    327331
Note: See TracChangeset for help on using the changeset viewer.