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. Built from https://develop.svn.wordpress.org/trunk@31958 git-svn-id: http://core.svn.wordpress.org/trunk@31937 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
af79adbdd4
commit
5855cb0e60
|
@ -178,17 +178,20 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) {
|
||||||
width = c.match( /width="([0-9]*)"/ );
|
width = c.match( /width="([0-9]*)"/ );
|
||||||
width = ( width && width[1] ) ? width[1] : '';
|
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 ( ! width || ! caption ) {
|
||||||
|
if ( 'alignnone' !== align[0] ) {
|
||||||
|
c = c.replace( /><img/, ' class="' + align[0] + '"><img' );
|
||||||
|
}
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
id = b.match( /id="([^"]*)"/ );
|
id = b.match( /id="([^"]*)"/ );
|
||||||
id = ( id && id[1] ) ? id[1] : '';
|
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, '' );
|
classes = classes.replace( /wp-caption ?|align[a-z]+ ?/gi, '' );
|
||||||
|
|
||||||
if ( classes ) {
|
if ( classes ) {
|
||||||
|
|
File diff suppressed because one or more lines are too long
Binary file not shown.
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.2-beta3-31957';
|
$wp_version = '4.2-beta3-31958';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue