diff --git a/src/wp-includes/js/mce-view.js b/src/wp-includes/js/mce-view.js
index f5c4857..12e8eca 100644
a
|
b
|
window.wp = window.wp || {}; |
508 | 508 | |
509 | 509 | iframeDoc = iframe.contentWindow.document; |
510 | 510 | |
511 | | iframeDoc.open(); |
| 511 | resize = function() { |
| 512 | var $iframe, iframeDocHeight; |
| 513 | |
| 514 | // Make sure the iframe still exists. |
| 515 | if ( iframe.contentWindow ) { |
| 516 | $iframe = $( iframe ); |
| 517 | iframeDocHeight = $( iframeDoc.body ).height(); |
| 518 | |
| 519 | if ( $iframe.height() !== iframeDocHeight ) { |
| 520 | $iframe.height( iframeDocHeight ); |
| 521 | editor.nodeChanged(); |
| 522 | } |
| 523 | } |
| 524 | }; |
| 525 | |
| 526 | if ( MutationObserver ) { |
| 527 | observer = new MutationObserver( _.debounce( function( mutations ) { |
| 528 | |
| 529 | resize(); |
| 530 | |
| 531 | // Trigger resize after images have loaded. |
| 532 | mutations.forEach( function( mutation ) { |
| 533 | _.each( mutation.addedNodes, function( node ) { |
| 534 | $(node).find('img').load( resize ); |
| 535 | } ); |
| 536 | }); |
| 537 | |
| 538 | }, 100 ) ); |
| 539 | |
| 540 | observer.observe( iframeDoc, { |
| 541 | attributes: true, |
| 542 | childList: true, |
| 543 | subtree: true |
| 544 | } ); |
| 545 | } else { |
| 546 | for ( i = 1; i < 6; i++ ) { |
| 547 | setTimeout( resize, i * 700 ); |
| 548 | } |
| 549 | } |
512 | 550 | |
| 551 | iframeDoc.open(); |
513 | 552 | iframeDoc.write( |
514 | 553 | '<!DOCTYPE html>' + |
515 | 554 | '<html>' + |
… |
… |
window.wp = window.wp || {}; |
540 | 579 | '</body>' + |
541 | 580 | '</html>' |
542 | 581 | ); |
543 | | |
544 | 582 | iframeDoc.close(); |
545 | 583 | |
546 | | resize = function() { |
547 | | var $iframe, iframeDocHeight; |
548 | | |
549 | | // Make sure the iframe still exists. |
550 | | if ( iframe.contentWindow ) { |
551 | | $iframe = $( iframe ); |
552 | | iframeDocHeight = $( iframeDoc.body ).height(); |
553 | | |
554 | | if ( $iframe.height() !== iframeDocHeight ) { |
555 | | $iframe.height( iframeDocHeight ); |
556 | | editor.nodeChanged(); |
557 | | } |
558 | | } |
559 | | }; |
560 | | |
561 | | if ( MutationObserver ) { |
562 | | observer = new MutationObserver( _.debounce( function() { |
563 | | resize(); |
564 | | }, 100 ) ); |
565 | | |
566 | | observer.observe( iframeDoc.body, { |
567 | | attributes: true, |
568 | | childList: true, |
569 | | subtree: true |
570 | | } ); |
571 | | } else { |
572 | | for ( i = 1; i < 6; i++ ) { |
573 | | setTimeout( resize, i * 700 ); |
574 | | } |
575 | | } |
576 | | |
577 | 584 | function classChange() { |
578 | 585 | iframeDoc.body.className = editor.getBody().className; |
579 | 586 | } |