From bbfabf7fb554d819b7bc1057ae5615e3614abf7e Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Wed, 1 Apr 2015 16:03:36 +0000 Subject: [PATCH] When editing an image from the editor, and the image has a value for alignment (but not for `width` or `caption`), don't bail without first checking that the alignment's value is not `alignnone`. If so, add the `class` to the `` before bailing. See #21848. git-svn-id: https://develop.svn.wordpress.org/trunk@31958 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 a30b034291..a23c077a4d 100644 --- a/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js +++ b/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js @@ -178,17 +178,20 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) { width = c.match( /width="([0-9]*)"/ ); width = ( width && width[1] ) ? width[1] : ''; + classes = b.match( /class="([^"]*)"/ ); + classes = ( classes && classes[1] ) ? classes[1] : ''; + align = classes.match( /align[a-z]+/i ) || 'alignnone'; + if ( ! width || ! caption ) { + if ( 'alignnone' !== align[0] ) { + c = c.replace( />