File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -152,9 +152,16 @@ window.addEventListener("load", function() {
152
152
function placeFrame ( frame , snippet ) {
153
153
var wrap = snippet . previousSibling ;
154
154
if ( ! wrap || wrap . className != "editor-wrap" ) {
155
+ var bot = snippet . getBoundingClientRect ( ) . bottom ;
155
156
activateCode ( snippet , null , "text/html" ) ;
156
157
wrap = snippet . previousSibling ;
158
+ } else {
159
+ bot = wrap . getBoundingClientRect ( ) . bottom ;
157
160
}
158
161
wrap . insertBefore ( frame , wrap . childNodes [ 1 ] ) ;
162
+ if ( bot < 50 ) {
163
+ var newBot = wrap . getBoundingClientRect ( ) . bottom ;
164
+ window . scrollBy ( 0 , newBot - bot ) ;
165
+ }
159
166
}
160
167
} ) ;
Original file line number Diff line number Diff line change 89
89
return "" ;
90
90
} ) ;
91
91
92
- this . frame . style . height = "10px " ;
92
+ this . frame . style . height = "80px " ;
93
93
this . resizeFrame ( ) ;
94
94
if ( scriptTags . length ) {
95
95
if ( output ) this . output = output ;
96
96
this . startedAt = Date . now ( ) ;
97
97
this . extraSecs = 1 ;
98
98
this . win . __c = 0 ;
99
- var resize = doc . createElement ( "script" ) ;
100
- resize . innerHTML = "__sandbox.resizeFrame();" ;
101
- scriptTags . push ( resize ) ;
102
99
scriptTags . forEach ( function ( tag ) { doc . body . appendChild ( tag ) ; } ) ;
100
+ setTimeout ( this . resizeFrame . bind ( this ) , 50 ) ;
103
101
}
104
102
} ,
105
103
resizeFrame : function ( ) {
You can’t perform that action at this time.
0 commit comments