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();