Changeset 30437
- Timestamp:
- 11/20/2014 01:51:34 PM (10 years ago)
- Location:
- branches/3.9
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.9
-
branches/3.9/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js
r28231 r30437 1 1 /* global tinymce */ 2 2 tinymce.PluginManager.add( 'wpeditimage', function( editor ) { 3 var toolbarActive = false; 3 var serializer, 4 toolbarActive = false; 4 5 5 6 function parseShortcode( content ) { … … 209 210 } 210 211 212 // Verify HTML in captions 213 function verifyHTML( caption ) { 214 if ( ! caption || ( caption.indexOf( '<' ) === -1 && caption.indexOf( '>' ) === -1 ) ) { 215 return caption; 216 } 217 218 if ( ! serializer ) { 219 serializer = new tinymce.html.Serializer( {}, editor.schema ); 220 } 221 222 return serializer.serialize( editor.parser.parse( caption, { forced_root_block: false } ) ); 223 } 224 211 225 function updateImage( imageNode, imageData ) { 212 226 var classes, className, node, html, parent, wrap, linkNode, … … 286 300 287 301 if ( imageData.caption ) { 302 imageData.caption = verifyHTML( imageData.caption ); 288 303 289 304 id = imageData.attachment_id ? 'attachment_' + imageData.attachment_id : null; … … 564 579 // Convert remaining line breaks to <br> 565 580 caption = caption.replace( /(<br[^>]*>)\s*\n\s*/g, '$1' ).replace( /\s*\n\s*/g, '<br />' ); 581 caption = verifyHTML( caption ); 566 582 } 567 583
Note: See TracChangeset
for help on using the changeset viewer.