TinyMCE: initialize the floating toolbars on preinit so we can attach other events on init.
Props iseulde. Fixes #30619. Built from https://develop.svn.wordpress.org/trunk@31732 git-svn-id: http://core.svn.wordpress.org/trunk@31713 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
cb185ed5bc
commit
7d2b380330
|
@ -1,6 +1,6 @@
|
|||
/* global tinymce */
|
||||
tinymce.PluginManager.add( 'wpeditimage', function( editor ) {
|
||||
var floatingToolbar, serializer,
|
||||
var toolbar, serializer,
|
||||
each = tinymce.each,
|
||||
iOS = tinymce.Env.iOS;
|
||||
|
||||
|
@ -59,9 +59,20 @@ 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'
|
||||
] );
|
||||
} );
|
||||
|
||||
editor.on( 'wptoolbar', function( event ) {
|
||||
if ( event.element.nodeName === 'IMG' && ! isPlaceholder( event.element ) ) {
|
||||
event.toolbar = floatingToolbar;
|
||||
event.toolbar = toolbar;
|
||||
}
|
||||
} );
|
||||
|
||||
|
@ -77,7 +88,7 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) {
|
|||
editor.nodeChanged();
|
||||
}, 200 );
|
||||
} else {
|
||||
floatingToolbar.hide();
|
||||
toolbar.hide();
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
@ -544,17 +555,6 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) {
|
|||
|
||||
dom.addClass( editor.getBody(), captionClass );
|
||||
|
||||
if ( editor.wp._createToolbar ) {
|
||||
floatingToolbar = editor.wp._createToolbar( [
|
||||
'wp_img_alignleft',
|
||||
'wp_img_aligncenter',
|
||||
'wp_img_alignright',
|
||||
'wp_img_alignnone',
|
||||
'wp_img_edit',
|
||||
'wp_img_remove'
|
||||
] );
|
||||
}
|
||||
|
||||
// Add caption field to the default image dialog
|
||||
editor.on( 'wpLoadImageForm', function( event ) {
|
||||
if ( editor.getParam( 'wpeditimage_disable_captions' ) ) {
|
||||
|
@ -867,8 +867,8 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) {
|
|||
editor.nodeChanged();
|
||||
event.preventDefault();
|
||||
|
||||
if ( floatingToolbar ) {
|
||||
floatingToolbar.reposition();
|
||||
if ( toolbar ) {
|
||||
toolbar.reposition();
|
||||
}
|
||||
|
||||
editor.fire( 'ExecCommand', {
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -240,11 +240,6 @@ tinymce.PluginManager.add( 'wpview', function( editor ) {
|
|||
selection = editor.selection,
|
||||
MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
|
||||
|
||||
toolbar = editor.wp._createToolbar( [
|
||||
'wp_view_edit',
|
||||
'wp_view_remove'
|
||||
] );
|
||||
|
||||
// When a view is selected, ensure content that is being pasted
|
||||
// or inserted is added to a text node (instead of the view).
|
||||
editor.on( 'BeforeSetContent', function() {
|
||||
|
@ -673,6 +668,13 @@ tinymce.PluginManager.add( 'wpview', function( editor ) {
|
|||
}
|
||||
} );
|
||||
|
||||
editor.once( 'preinit', function() {
|
||||
toolbar = editor.wp._createToolbar( [
|
||||
'wp_view_edit',
|
||||
'wp_view_remove'
|
||||
] );
|
||||
} );
|
||||
|
||||
editor.on( 'wptoolbar', function( event ) {
|
||||
if ( selected ) {
|
||||
event.element = selected;
|
||||
|
|
File diff suppressed because one or more lines are too long
Binary file not shown.
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.2-alpha-31731';
|
||||
$wp_version = '4.2-alpha-31732';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue