Make WordPress Core

Changeset 31958


Ignore:
Timestamp:
04/01/2015 04:03:36 PM (9 years ago)
Author:
wonderboymusic
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js

    r31738 r31958  
    179179                width = ( width && width[1] ) ? width[1] : '';
    180180
     181                classes = b.match( /class="([^"]*)"/ );
     182                classes = ( classes && classes[1] ) ? classes[1] : '';
     183                align = classes.match( /align[a-z]+/i ) || 'alignnone';
     184
    181185                if ( ! width || ! caption ) {
     186                    if ( 'alignnone' !== align[0] ) {
     187                        c = c.replace( /><img/, ' class="' + align[0] + '"><img' );
     188                    }
    182189                    return c;
    183190                }
     
    186193                id = ( id && id[1] ) ? id[1] : '';
    187194
    188                 classes = b.match( /class="([^"]*)"/ );
    189                 classes = ( classes && classes[1] ) ? classes[1] : '';
    190 
    191                 align = classes.match( /align[a-z]+/i ) || 'alignnone';
    192195                classes = classes.replace( /wp-caption ?|align[a-z]+ ?/gi, '' );
    193196
Note: See TracChangeset for help on using the changeset viewer.