TinyMCE: bring back removal of the size-* class when the user soft-resizes an image, see #24409

git-svn-id: https://develop.svn.wordpress.org/trunk@27694 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2014-03-25 00:15:37 +00:00
parent 98921c5ca0
commit a00d98a8c2

View File

@ -668,11 +668,14 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) {
editor.on( 'ObjectResized', function( event ) {
var parent, width,
node = event.target;
node = event.target,
dom = editor.dom;
if ( node.nodeName === 'IMG' ) {
if ( parent = editor.dom.getParent( node, '.wp-caption' ) ) {
width = event.width || editor.dom.getAttrib( node, 'width' );
node.className = node.className.replace( /\bsize-[^ ]+/, '' );
if ( parent = dom.getParent( node, '.wp-caption' ) ) {
width = event.width || dom.getAttrib( node, 'width' );
if ( width ) {
width = parseInt( width, 10 );
@ -681,7 +684,7 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) {
width += 10;
}
editor.dom.setStyle( parent, 'width', width + 'px' );
dom.setStyle( parent, 'width', width + 'px' );
}
}
// refresh toolbar