TinyMCE: set the proper caption width when clicking image resize handle on image with caption. Props gcorne, fixes #27009, see #24067.

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


git-svn-id: http://core.svn.wordpress.org/trunk@26969 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2014-02-05 02:07:13 +00:00
parent 228fc639b9
commit c4f8dede57
3 changed files with 8 additions and 3 deletions

View File

@ -495,11 +495,16 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) {
});
editor.on( 'ObjectResized', function( event ) {
var parent,
var parent, width,
node = event.target;
if ( node.nodeName === 'IMG' && ( parent = editor.dom.getParent( node, '.wp-caption' ) ) ) {
editor.dom.setStyle( parent, 'width', 10 + event.width + 'px' );
width = event.width || editor.dom.getAttrib( node, 'width' );
if ( width ) {
width = parseInt( width, 10 ) + 10;
editor.dom.setStyle( parent, 'width', width + 'px' );
}
}
});

File diff suppressed because one or more lines are too long