Ticket #31464: 31464.3.patch
| File 31464.3.patch, 3.0 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, 468 styles = '',469 467 bodyClasses = editor.getBody().className || '', 470 468 iframe, iframeDoc, observer, i, resize; 471 469 472 470 content.innerHTML = ''; 473 head = head || '';474 471 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; 472 tinymce.each( dom.$( 473 'link[rel="stylesheet"]', 474 editor.getDoc().getElementsByTagName( 'head' )[0] 475 ), function( link ) { 476 if ( 477 link.href && 478 link.href.indexOf( 'skins/lightgray/content.min.css' ) === -1 && 479 link.href.indexOf( 'skins/wordpress/wp-content.css' ) === -1 480 ) { 481 head += dom.getOuterHTML( link ) + '\n'; 488 482 } 489 } 483 } ); 490 484 491 485 // Seems Firefox needs a bit of time to insert/set the view nodes, 492 486 // or the iframe will fail especially when switching Text => Visual. … … 516 510 '<head>' + 517 511 '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />' + 518 512 head + 519 styles +520 513 '<style>' + 521 514 'html {' + 522 515 'background: transparent;' + … … 578 571 iframeDoc.body.className = editor.getBody().className; 579 572 } 580 573 581 if ( importStyles ) { 582 editor.on( 'wp-body-class-change', classChange ); 583 } 574 editor.on( 'wp-body-class-change', classChange ); 584 575 585 576 $( node ).one( 'wp-mce-view-unbind', function() { 586 577 observer.disconnect();