File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4141 self . win = frame . contentWindow ;
4242 self . setupEnv ( ) ;
4343
44- self . frame . addEventListener ( "load" , function ( ) {
44+ function resize ( ) {
4545 if ( self . frame . style . display != "none" ) self . resizeFrame ( ) ;
46- } ) ;
46+ }
47+ self . frame . addEventListener ( "load" , resize ) ;
48+ var resizeTimeout = null ;
49+ function scheduleResize ( ) {
50+ self . win . clearTimeout ( resizeTimeout ) ;
51+ self . win . __setTimeout ( resize , 200 ) ;
52+ }
53+ self . win . addEventListener ( "keydown" , scheduleResize ) ;
54+ self . win . addEventListener ( "mousedown" , scheduleResize ) ;
4755
4856 if ( options . loadFiles ) {
4957 var i = 0 ;
179187 } ;
180188 } ,
181189 resizeFrame : function ( ) {
182- this . frame . style . height = Math . max ( 80 , Math . min ( this . win . document . body . scrollHeight + 20 , 500 ) ) + "px" ;
190+ this . frame . style . height = Math . max ( 80 , Math . min ( this . win . document . documentElement . offsetHeight + 10 , 500 ) ) + "px" ;
183191 var box = this . frame . getBoundingClientRect ( ) ;
184192 if ( box . bottom > box . top && box . top >= 0 && box . top < window . innerHeight && box . bottom > window . innerHeight )
185193 window . scrollBy ( 0 , Math . min ( box . top , box . bottom - window . innerHeight ) ) ;
You can’t perform that action at this time.
0 commit comments