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

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


git-svn-id: http://core.svn.wordpress.org/trunk@27533 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2014-03-25 00:16:14 +00:00
parent d85ac5b841
commit a3d08715ab
3 changed files with 8 additions and 5 deletions

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

File diff suppressed because one or more lines are too long