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.

Built from https://develop.svn.wordpress.org/trunk@26983


git-svn-id: http://core.svn.wordpress.org/trunk@26860 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2014-01-19 23:22:14 +00:00
parent ec5288d405
commit 910ec9c462
3 changed files with 7 additions and 3 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;

File diff suppressed because one or more lines are too long