Changeset 31740
- Timestamp:
- 03/11/2015 11:52:15 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/js/mce-view.js
r31731 r31740 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 ) { … … 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 */ … … 589 588 } ); 590 589 } 590 591 callback && callback.apply( this, arguments ); 591 592 }, 50 ); 592 593 callback && callback.apply( this, arguments );594 593 }, rendered ); 595 594 },
Note: See TracChangeset
for help on using the changeset viewer.