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

git-svn-id: https://develop.svn.wordpress.org/trunk@27098 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2014-02-05 02:06:10 +00:00
parent 71947f18d3
commit 5a3fb502cb

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' );
}
}
});