wp/wp-includes/js/tinymce/plugins/wordpress/plugin.js
changeset 18 be944660c56a
parent 16 a86126ab1dd4
child 19 3d72ae0968f4
equal deleted inserted replaced
17:34716fd837a4 18:be944660c56a
    14 		wp = window.wp,
    14 		wp = window.wp,
    15 		hasWpautop = ( wp && wp.editor && wp.editor.autop && editor.getParam( 'wpautop', true ) ),
    15 		hasWpautop = ( wp && wp.editor && wp.editor.autop && editor.getParam( 'wpautop', true ) ),
    16 		wpTooltips = false;
    16 		wpTooltips = false;
    17 
    17 
    18 	if ( $ ) {
    18 	if ( $ ) {
       
    19 		// Runs as soon as TinyMCE has started initializing, while plugins are loading.
       
    20 		// Handlers attached after the `tinymce.init()` call may not get triggered for this instance.
    19 		$( document ).triggerHandler( 'tinymce-editor-setup', [ editor ] );
    21 		$( document ).triggerHandler( 'tinymce-editor-setup', [ editor ] );
    20 	}
    22 	}
    21 
    23 
    22 	function toggleToolbars( state ) {
    24 	function toggleToolbars( state ) {
    23 		var initial, toolbars, iframeHeight,
    25 		var initial, toolbars, iframeHeight,
   538 					.replace( /<\/(p|div|ul|ol|dl|table|blockquote|h[1-6]|fieldset|pre)>\s*<\/p>/gi, '</$1>' );
   540 					.replace( /<\/(p|div|ul|ol|dl|table|blockquote|h[1-6]|fieldset|pre)>\s*<\/p>/gi, '</$1>' );
   539 			}
   541 			}
   540 		});
   542 		});
   541 
   543 
   542 		if ( $ ) {
   544 		if ( $ ) {
   543 			$( document ).triggerHandler( 'tinymce-editor-init', [editor] );
   545 			// Run on DOM ready. Otherwise TinyMCE may initialize earlier and handlers attached
       
   546 			// on DOM ready of after the `tinymce.init()` call may not get triggered.
       
   547 			$( function() {
       
   548 				$( document ).triggerHandler( 'tinymce-editor-init', [editor] );
       
   549 			});
   544 		}
   550 		}
   545 
   551 
   546 		if ( window.tinyMCEPreInit && window.tinyMCEPreInit.dragDropUpload ) {
   552 		if ( window.tinyMCEPreInit && window.tinyMCEPreInit.dragDropUpload ) {
   547 			dom.bind( doc, 'dragstart dragend dragover drop', function( event ) {
   553 			dom.bind( doc, 'dragstart dragend dragover drop', function( event ) {
   548 				if ( $ ) {
   554 				if ( $ ) {