TinyMCE: ensure the wordpress plugin is loaded before calling _createToolbar().

Props hauvong, azaozz. Fixes #33393.

git-svn-id: https://develop.svn.wordpress.org/trunk@33728 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2015-08-25 04:37:27 +00:00
parent 3b525395cc
commit a9b27cbc07
3 changed files with 24 additions and 18 deletions

View File

@ -61,14 +61,16 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) {
} );
editor.once( 'preinit', function() {
toolbar = editor.wp._createToolbar( [
'wp_img_alignleft',
'wp_img_aligncenter',
'wp_img_alignright',
'wp_img_alignnone',
'wp_img_edit',
'wp_img_remove'
] );
if ( editor.wp && editor.wp._createToolbar ) {
toolbar = editor.wp._createToolbar( [
'wp_img_alignleft',
'wp_img_aligncenter',
'wp_img_alignright',
'wp_img_alignnone',
'wp_img_edit',
'wp_img_remove'
] );
}
} );
editor.on( 'wptoolbar', function( event ) {
@ -88,7 +90,7 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) {
editor.selection.select( node );
editor.nodeChanged();
}, 200 );
} else {
} else if ( toolbar ) {
toolbar.hide();
}
} );

View File

@ -136,11 +136,13 @@
} );
editor.on( 'preinit', function() {
toolbar = editor.wp._createToolbar( [
'wp_link_preview',
'wp_link_edit',
'wp_link_remove'
], true );
if ( editor.wp && editor.wp._createToolbar ) {
toolbar = editor.wp._createToolbar( [
'wp_link_preview',
'wp_link_edit',
'wp_link_remove'
], true );
}
} );
} );
} )( window.tinymce );

View File

@ -713,10 +713,12 @@ tinymce.PluginManager.add( 'wpview', function( editor ) {
} );
editor.once( 'preinit', function() {
toolbar = editor.wp._createToolbar( [
'wp_view_edit',
'wp_view_remove'
] );
if ( editor.wp && editor.wp._createToolbar ) {
toolbar = editor.wp._createToolbar( [
'wp_view_edit',
'wp_view_remove'
] );
}
} );
editor.on( 'wptoolbar', function( event ) {