Ticket #31464: 31464.2.patch
| File 31464.2.patch, 2.7 KB (added by , 11 years ago) |
|---|
-
src/wp-includes/js/mce-view.js
434 434 if ( _.isObject( content ) && content.body.indexOf( '<script' ) !== -1 ) { 435 435 this.setIframes( content.head, content.body, callback, rendered ); 436 436 } else if ( _.isString( content ) && content.indexOf( '<script' ) !== -1 ) { 437 this.setIframes( null, content, callback, rendered );437 this.setIframes( '', content, callback, rendered ); 438 438 } else { 439 439 this.getNodes( function( editor, node, contentNode ) { 440 440 content = content.body || content; … … 460 460 * @param {Boolean} rendered Only set for (un)rendered nodes. Optional. 461 461 */ 462 462 setIframes: function( head, body, callback, rendered ) { 463 var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver, 464 importStyles = this.type === 'video' || this.type === 'audio' || this.type === 'playlist'; 463 var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; 465 464 466 465 this.getNodes( function( editor, node, content ) { 467 466 var dom = editor.dom, … … 470 469 iframe, iframeDoc, observer, i, resize; 471 470 472 471 content.innerHTML = ''; 473 head = head || '';474 472 475 if ( importStyles ) { 476 if ( ! wp.mce.views.sandboxStyles ) { 477 tinymce.each( dom.$( 'link[rel="stylesheet"]', editor.getDoc().head ), function( link ) { 478 if ( link.href && link.href.indexOf( 'skins/lightgray/content.min.css' ) === -1 && 479 link.href.indexOf( 'skins/wordpress/wp-content.css' ) === -1 ) { 480 481 styles += dom.getOuterHTML( link ) + '\n'; 482 } 483 }); 484 485 wp.mce.views.sandboxStyles = styles; 486 } else { 487 styles = wp.mce.views.sandboxStyles; 473 tinymce.each( dom.$( 474 'link[rel="stylesheet"]', 475 editor.getDoc().getElementsByTagName( 'head' )[0] 476 ), function( link ) { 477 if ( 478 link.href && 479 link.href.indexOf( 'skins/lightgray/content.min.css' ) === -1 && 480 link.href.indexOf( 'skins/wordpress/wp-content.css' ) === -1 481 ) { 482 styles += dom.getOuterHTML( link ) + '\n'; 488 483 } 489 } 484 } ); 490 485 491 486 // Seems Firefox needs a bit of time to insert/set the view nodes, 492 487 // or the iframe will fail especially when switching Text => Visual. … … 578 573 iframeDoc.body.className = editor.getBody().className; 579 574 } 580 575 581 if ( importStyles ) { 582 editor.on( 'wp-body-class-change', classChange ); 583 } 576 editor.on( 'wp-body-class-change', classChange ); 584 577 585 578 $( node ).one( 'wp-mce-view-unbind', function() { 586 579 observer.disconnect();