TinyMCE: wpeditimage: trim class

Don't add extra spaces to classes. It causes some tests in the TinyMCE QUnit test suite to fail.

Fixes #31764.


git-svn-id: https://develop.svn.wordpress.org/trunk@32592 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ella Iseulde Van Dorpe 2015-05-25 06:34:27 +00:00
parent 7baa0296ad
commit 1e6be9cd89

View File

@ -2,6 +2,7 @@
tinymce.PluginManager.add( 'wpeditimage', function( editor ) {
var toolbar, serializer,
each = tinymce.each,
trim = tinymce.trim,
iOS = tinymce.Env.iOS;
function isPlaceholder( node ) {
@ -95,8 +96,7 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) {
function parseShortcode( content ) {
return content.replace( /(?:<p>)?\[(?:wp_)?caption([^\]]+)\]([\s\S]+?)\[\/(?:wp_)?caption\](?:<\/p>)?/g, function( a, b, c ) {
var id, align, classes, caption, img, width,
trim = tinymce.trim;
var id, align, classes, caption, img, width;
id = b.match( /id=['"]([^'"]*)['"] ?/ );
if ( id ) {
@ -865,7 +865,7 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) {
replacement = ' ' + align;
}
node.className = node.className.replace( / ?align(left|center|right|none)/g, '' ) + replacement;
node.className = trim( node.className.replace( / ?align(left|center|right|none)/g, '' ) + replacement );
editor.nodeChanged();
event.preventDefault();