From a00d98a8c23c0e7006e8f20baa84fc3d67181b76 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Tue, 25 Mar 2014 00:15:37 +0000 Subject: [PATCH] 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 --- .../js/tinymce/plugins/wpeditimage/plugin.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js b/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js index b43e5beab5..2d2e587fdd 100644 --- a/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js +++ b/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js @@ -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