From 1e6be9cd89baa85d8a1e91c3436ed665c8a726f9 Mon Sep 17 00:00:00 2001 From: Ella Iseulde Van Dorpe Date: Mon, 25 May 2015 06:34:27 +0000 Subject: [PATCH] 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 --- src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js b/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js index 025603b41e..856f429f41 100644 --- a/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js +++ b/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js @@ -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( /(?:

)?\[(?: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();