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.

git-svn-id: https://develop.svn.wordpress.org/trunk@26983 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2014-01-19 23:21:07 +00:00
parent ae49162491
commit 1bc97d1fe4
1 changed files with 6 additions and 2 deletions

View File

@ -310,10 +310,14 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
e.content = e.content.replace(/<\/(p|div|ul|ol|dl|table|blockquote|h[1-6]|fieldset|pre|address)>\s*<\/p>/gi, '</$1>');
}
});
if ( typeof window.jQuery !== 'undefined' ) {
window.jQuery( document ).triggerHandler( 'tinymce-editor-init', [editor] );
}
});
// Word count
if ( typeof jQuery !== 'undefined' ) {
if ( typeof window.jQuery !== 'undefined' ) {
editor.on( 'keyup', function( e ) {
var key = e.keyCode || e.charCode;
@ -322,7 +326,7 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
}
if ( 13 === key || 8 === last || 46 === last ) {
jQuery(document).triggerHandler( 'wpcountwords', [ editor.getContent({ format : 'raw' }) ] );
window.jQuery( document ).triggerHandler( 'wpcountwords', [ editor.getContent({ format : 'raw' }) ] );
}
last = key;