Ticket #32593: 32593.2.patch
File 32593.2.patch, 1.8 KB (added by , 10 years ago) |
---|
-
src/wp-includes/js/mce-view.js
501 501 } 502 502 } ); 503 503 504 if ( self.iframeHeight ) { 505 dom.add( contentNode, 'div', { style: { 506 width: '100%', 507 height: self.iframeHeight 508 } } ); 509 } 510 504 511 // Seems the browsers need a bit of time to insert/set the view nodes, 505 512 // or the iframe will fail especially when switching Text => Visual. 506 513 setTimeout( function() { 507 var iframe, iframeDoc, observer, i ;514 var iframe, iframeDoc, observer, i, block; 508 515 509 516 contentNode.innerHTML = ''; 510 517 … … 518 525 style: { 519 526 width: '100%', 520 527 display: 'block' 521 } 528 }, 529 height: self.iframeHeight 522 530 } ); 523 531 524 532 dom.add( contentNode, 'div', { 'class': 'wpview-overlay' } ); … … 561 569 iframeDoc.close(); 562 570 563 571 function resize() { 564 var $iframe, iframeDocHeight; 572 var $iframe; 573 574 if ( block ) { 575 return; 576 } 565 577 566 578 // Make sure the iframe still exists. 567 579 if ( iframe.contentWindow ) { 568 580 $iframe = $( iframe ); 569 iframeDocHeight = $( iframeDoc.body ).height();581 self.iframeHeight = $( iframeDoc.body ).height(); 570 582 571 if ( $iframe.height() !== iframeDocHeight ) {572 $iframe.height( iframeDocHeight );583 if ( $iframe.height() !== self.iframeHeight ) { 584 $iframe.height( self.iframeHeight ); 573 585 editor.nodeChanged(); 574 586 } 575 587 } 576 588 } 577 589 590 if ( self.iframeHeight ) { 591 block = true; 592 593 setTimeout( function () { 594 block = false; 595 resize(); 596 }, 2000 ); 597 } 598 578 599 $( iframe.contentWindow ).on( 'load', resize ); 579 600 580 601 if ( MutationObserver ) {