TinyMCE: add/remove the 'alignnone' class when aligning images without captions. See #24067.
Built from https://develop.svn.wordpress.org/trunk@26942 git-svn-id: http://core.svn.wordpress.org/trunk@26822 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -364,7 +364,6 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) {
|
||||
}
|
||||
}
|
||||
} else if ( cmd === 'JustifyLeft' || cmd === 'JustifyRight' || cmd === 'JustifyCenter' ) {
|
||||
// When inside an image caption, set the align* class on dt.wp-caption
|
||||
node = editor.selection.getNode();
|
||||
align = cmd.substr(7).toLowerCase();
|
||||
align = 'align' + align;
|
||||
@@ -376,6 +375,7 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) {
|
||||
}
|
||||
|
||||
if ( DL ) {
|
||||
// When inside an image caption, set the align* class on dl.wp-caption
|
||||
if ( dom.hasClass( DL, align ) ) {
|
||||
dom.removeClass( DL, align );
|
||||
dom.addClass( DL, 'alignnone' );
|
||||
@@ -386,6 +386,15 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( node.nodeName === 'IMG' ) {
|
||||
if ( dom.hasClass( node, align ) ) {
|
||||
// The align class is being removed
|
||||
dom.addClass( node, 'alignnone' );
|
||||
} else {
|
||||
dom.removeClass( node, 'alignnone' );
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user