Changeset 40019 for trunk/src/wp-includes/js/mce-view.js
- Timestamp:
- 01/27/2017 04:24:58 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/js/mce-view.js
r39903 r40019 469 469 */ 470 470 setContent: function( content, callback, rendered ) { 471 if ( _.isObject( content ) && content.body.indexOf( '<script' ) !== -1) {471 if ( _.isObject( content ) && ( content.sandbox || content.head || content.body.indexOf( '<script' ) !== -1 ) ) { 472 472 this.setIframes( content.head || '', content.body, callback, rendered ); 473 473 } else if ( _.isString( content ) && content.indexOf( '<script' ) !== -1 ) { … … 585 585 'content: "";' + 586 586 '}' + 587 'iframe {' + 588 'max-width: 100%;' + 589 '}' + 587 590 '</style>' + 588 591 '</head>' + … … 624 627 625 628 function reload() { 626 $( node ).data( 'rendered', null ); 627 628 setTimeout( function() { 629 wp.mce.views.render(); 630 } ); 631 } 632 633 $( iframeWin ).on( 'load', resize ).on( 'unload', reload ); 634 635 MutationObserver = iframeWin.MutationObserver || iframeWin.WebKitMutationObserver || iframeWin.MozMutationObserver; 636 637 if ( MutationObserver ) { 629 if ( ! editor.isHidden() ) { 630 $( node ).data( 'rendered', null ); 631 632 setTimeout( function() { 633 wp.mce.views.render(); 634 } ); 635 } 636 } 637 638 function addObserver() { 638 639 observer = new MutationObserver( _.debounce( resize, 100 ) ); 639 640 … … 643 644 subtree: true 644 645 } ); 646 } 647 648 $( iframeWin ).on( 'load', resize ).on( 'unload', reload ); 649 650 MutationObserver = iframeWin.MutationObserver || iframeWin.WebKitMutationObserver || iframeWin.MozMutationObserver; 651 652 if ( MutationObserver ) { 653 if ( ! iframeDoc.body ) { 654 iframeDoc.addEventListener( 'DOMContentLoaded', addObserver, false ); 655 } else { 656 addObserver(); 657 } 645 658 } else { 646 659 for ( i = 1; i < 6; i++ ) {
Note: See TracChangeset
for help on using the changeset viewer.