Changeset 30435
- Timestamp:
- 11/20/2014 01:48:20 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js
r30385 r30435 1 1 /* global tinymce */ 2 2 tinymce.PluginManager.add( 'wpeditimage', function( editor ) { 3 var DOM = tinymce.DOM, 3 var tb, serializer, 4 DOM = tinymce.DOM, 4 5 settings = editor.settings, 5 6 Factory = tinymce.ui.Factory, … … 7 8 iOS = tinymce.Env.iOS, 8 9 toolbarIsHidden = true, 9 editorWrapParent = tinymce.$( '#postdivrich' ), 10 tb; 10 editorWrapParent = tinymce.$( '#postdivrich' ); 11 11 12 12 function isPlaceholder( node ) { … … 560 560 } 561 561 562 // Verify HTML in captions 563 function verifyHTML( caption ) { 564 if ( ! caption || ( caption.indexOf( '<' ) === -1 && caption.indexOf( '>' ) === -1 ) ) { 565 return caption; 566 } 567 568 if ( ! serializer ) { 569 serializer = new tinymce.html.Serializer( {}, editor.schema ); 570 } 571 572 return serializer.serialize( editor.parser.parse( caption, { forced_root_block: false } ) ); 573 } 574 562 575 function updateImage( imageNode, imageData ) { 563 576 var classes, className, node, html, parent, wrap, linkNode, … … 637 650 638 651 if ( imageData.caption ) { 652 imageData.caption = verifyHTML( imageData.caption ); 639 653 640 654 id = imageData.attachment_id ? 'attachment_' + imageData.attachment_id : null; … … 859 873 // Convert remaining line breaks to <br> 860 874 caption = caption.replace( /(<br[^>]*>)\s*\n\s*/g, '$1' ).replace( /\s*\n\s*/g, '<br />' ); 875 caption = verifyHTML( caption ); 861 876 } 862 877
Note: See TracChangeset
for help on using the changeset viewer.