TinyMCE: fix image captions regexp when wpautop is disabled in wp_editor(). Fixes #29592 for trunk.

Built from https://develop.svn.wordpress.org/trunk@29730


git-svn-id: http://core.svn.wordpress.org/trunk@29504 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2014-09-10 23:03:18 +00:00
parent 69e7171f41
commit 6592e13cae
3 changed files with 3 additions and 3 deletions

View File

@ -82,7 +82,7 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) {
return '';
}
out = b.replace( /<dl ([^>]+)>\s*<dt [^>]+>([\s\S]+?)<\/dt>\s*<dd [^>]+>([\s\S]*?)<\/dd>\s*<\/dl>/gi, function( a, b, c, caption ) {
out = b.replace( /\s*<dl ([^>]+)>\s*<dt [^>]+>([\s\S]+?)<\/dt>\s*<dd [^>]+>([\s\S]*?)<\/dd>\s*<\/dl>\s*/gi, function( a, b, c, caption ) {
var id, classes, align, width;
width = c.match( /width="([0-9]*)"/ );
@ -116,7 +116,7 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) {
return '[caption id="' + id + '" align="' + align + '" width="' + width + '"' + classes + ']' + c + ' ' + caption + '[/caption]';
});
if ( out.indexOf('[caption') !== 0 ) {
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 <p> with the caption text.
out = b.replace( /[\s\S]*?((?:<a [^>]+>)?<img [^>]+>(?:<\/a>)?)(<p>[\s\S]*<\/p>)?[\s\S]*/gi, '<p>$1</p>$2' );

File diff suppressed because one or more lines are too long