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 `<a>` before bailing.

See #21848.


git-svn-id: https://develop.svn.wordpress.org/trunk@31958 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2015-04-01 16:03:36 +00:00
parent efb8f1d491
commit bbfabf7fb5
1 changed files with 7 additions and 4 deletions

View File

@ -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( /><img/, ' class="' + align[0] + '"><img' );
}
return c;
}
id = b.match( /id="([^"]*)"/ );
id = ( id && id[1] ) ? id[1] : '';
classes = b.match( /class="([^"]*)"/ );
classes = ( classes && classes[1] ) ? classes[1] : '';
align = classes.match( /align[a-z]+/i ) || 'alignnone';
classes = classes.replace( /wp-caption ?|align[a-z]+ ?/gi, '' );
if ( classes ) {