diff --git a/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js b/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js
index 2779cd39dd..11f8a7954c 100644
--- a/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js
+++ b/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js
@@ -159,13 +159,13 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) {
}
function getShortcode( content ) {
- return content.replace( /
]*>([\s\S]+?)<\/div>/g, function( a, b ) {
+ return content.replace( /(?:
]+mceTemp[^>]+>)?\s*(
]+wp-caption[^>]+>[\s\S]+?<\/dl>)\s*(?:<\/div>)?/g, function( all, dl ) {
var out = '';
- if ( b.indexOf('
]+>([\s\S]+?)<\/dd>/i );
+ out = dl.match( /- ]+>([\s\S]+?)<\/dd>/i );
if ( out && out[1] ) {
return '
' + out[1] + '
';
@@ -174,7 +174,7 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) {
return '';
}
- out = b.replace( /\s*]+)>\s*- ]+>([\s\S]+?)<\/dt>\s*
- ]+>([\s\S]*?)<\/dd>\s*<\/dl>\s*/gi, function( a, b, c, caption ) {
+ out = dl.replace( /\s*
]+)>\s*- ]+>([\s\S]+?)<\/dt>\s*
- ]+>([\s\S]*?)<\/dd>\s*<\/dl>\s*/gi, function( a, b, c, caption ) {
var id, classes, align, width;
width = c.match( /width="([0-9]*)"/ );
@@ -214,7 +214,7 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) {
if ( out.indexOf('[caption') === -1 ) {
// the caption html seems broken, try to find the image that may be wrapped in a link
// and may be followed by
with the caption text.
- out = b.replace( /[\s\S]*?((?:]+>)?
]+>(?:<\/a>)?)([\s\S]*<\/p>)?[\s\S]*/gi, '
$1
$2' );
+ out = dl.replace( /[\s\S]*?((?:]+>)?
]+>(?:<\/a>)?)([\s\S]*<\/p>)?[\s\S]*/gi, '
$1
$2' );
}
return out;