TinyMCE: fix image captions regexp when wpautop is disabled in wp_editor(). Fixes #29592 for trunk.
git-svn-id: https://develop.svn.wordpress.org/trunk@29730 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
123fae73b5
commit
1190ed50a8
|
@ -82,7 +82,7 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) {
|
||||||
return '';
|
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;
|
var id, classes, align, width;
|
||||||
|
|
||||||
width = c.match( /width="([0-9]*)"/ );
|
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]';
|
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
|
// 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.
|
// 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' );
|
out = b.replace( /[\s\S]*?((?:<a [^>]+>)?<img [^>]+>(?:<\/a>)?)(<p>[\s\S]*<\/p>)?[\s\S]*/gi, '<p>$1</p>$2' );
|
||||||
|
|
Loading…
Reference in New Issue