Changeset 33834
- Timestamp:
- 08/31/2015 10:06:11 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js
r33728 r33834 160 160 161 161 function getShortcode( content ) { 162 return content.replace( / <div (?:id="attachment_|class="mceTemp)[^>]*>([\s\S]+?)<\/div>/g, function( a, b) {162 return content.replace( /(?:<div [^>]+mceTemp[^>]+>)?\s*(<dl [^>]+wp-caption[^>]+>[\s\S]+?<\/dl>)\s*(?:<\/div>)?/g, function( all, dl ) { 163 163 var out = ''; 164 164 165 if ( b.indexOf('<img ') === -1 ) {165 if ( dl.indexOf('<img ') === -1 ) { 166 166 // Broken caption. The user managed to drag the image out? 167 167 // Try to return the caption text as a paragraph. 168 out = b.match( /<dd [^>]+>([\s\S]+?)<\/dd>/i );168 out = dl.match( /<dd [^>]+>([\s\S]+?)<\/dd>/i ); 169 169 170 170 if ( out && out[1] ) { … … 175 175 } 176 176 177 out = b.replace( /\s*<dl ([^>]+)>\s*<dt [^>]+>([\s\S]+?)<\/dt>\s*<dd [^>]+>([\s\S]*?)<\/dd>\s*<\/dl>\s*/gi, function( a, b, c, caption ) {177 out = dl.replace( /\s*<dl ([^>]+)>\s*<dt [^>]+>([\s\S]+?)<\/dt>\s*<dd [^>]+>([\s\S]*?)<\/dd>\s*<\/dl>\s*/gi, function( a, b, c, caption ) { 178 178 var id, classes, align, width; 179 179 … … 215 215 // the caption html seems broken, try to find the image that may be wrapped in a link 216 216 // and may be followed by <p> with the caption text. 217 out = b.replace( /[\s\S]*?((?:<a [^>]+>)?<img [^>]+>(?:<\/a>)?)(<p>[\s\S]*<\/p>)?[\s\S]*/gi, '<p>$1</p>$2' );217 out = dl.replace( /[\s\S]*?((?:<a [^>]+>)?<img [^>]+>(?:<\/a>)?)(<p>[\s\S]*<\/p>)?[\s\S]*/gi, '<p>$1</p>$2' ); 218 218 } 219 219
Note: See TracChangeset
for help on using the changeset viewer.