Ticket #31412: 31412.25.patch
File 31412.25.patch, 2.9 KB (added by , 10 years ago) |
---|
-
src/wp-includes/js/mce-view.js
433 433 */ 434 434 setContent: function( content, callback, rendered ) { 435 435 if ( _.isObject( content ) && content.body.indexOf( '<script' ) !== -1 ) { 436 this.setIframes( content.head , content.body, callback, rendered );436 this.setIframes( content.head || '', content.body, callback, rendered ); 437 437 } else if ( _.isString( content ) && content.indexOf( '<script' ) !== -1 ) { 438 this.setIframes( null, content, callback, rendered );438 this.setIframes( '', content, callback, rendered ); 439 439 } else { 440 440 this.getNodes( function( editor, node, contentNode ) { 441 441 content = content.body || content; … … 465 465 importStyles = this.type === 'video' || this.type === 'audio' || this.type === 'playlist'; 466 466 467 467 this.getNodes( function( editor, node, content ) { 468 var dom = editor.dom,469 styles = '',470 bodyClasses = editor.getBody().className || '',471 iframe, iframeDoc, observer, i;472 473 content.innerHTML = '';474 head = head || '';475 476 if ( importStyles ) {477 if ( ! wp.mce.views.sandboxStyles ) {478 tinymce.each( dom.$( 'link[rel="stylesheet"]', editor.getDoc().head ), function( link ) {479 if ( link.href && 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';483 }484 });485 486 wp.mce.views.sandboxStyles = styles;487 } else {488 styles = wp.mce.views.sandboxStyles;489 }490 }491 492 468 // Seems Firefox needs a bit of time to insert/set the view nodes, 493 469 // or the iframe will fail especially when switching Text => Visual. 494 470 setTimeout( function() { 471 var dom = editor.dom, 472 styles = '', 473 bodyClasses = editor.getBody().className || '', 474 iframe, iframeDoc, observer, i; 475 476 if ( importStyles ) { 477 if ( ! wp.mce.views.sandboxStyles ) { 478 tinymce.each( dom.$( 'link[rel="stylesheet"]', editor.getDoc().head ), function( link ) { 479 if ( link.href && 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'; 483 } 484 }); 485 486 wp.mce.views.sandboxStyles = styles; 487 } else { 488 styles = wp.mce.views.sandboxStyles; 489 } 490 } 491 492 content.innerHTML = ''; 493 495 494 iframe = dom.add( content, 'iframe', { 496 495 /* jshint scripturl: true */ 497 496 src: tinymce.Env.ie ? 'javascript:""' : '', … … 588 587 editor.off( 'wp-body-class-change', classChange ); 589 588 } ); 590 589 } 591 }, 50 );592 590 593 callback && callback.apply( this, arguments ); 591 callback && callback.apply( this, arguments ); 592 }, 50 ); 594 593 }, rendered ); 595 594 }, 596 595