230 | | if ( wrapHeight && $window.scrollTop() > wrapHeight ) { |
231 | | window.scrollTo( window.pageXOffset, wrapHeight - 1 ); |
232 | | } |
| 228 | window.setTimeout( function() { |
| 229 | var wrapHeight = $( '#wpwrap' ).height(), |
| 230 | windowPos = $window.scrollTop(), |
| 231 | iframeHeight = $('#content_ifr').height(), |
| 232 | textareaHeight = $textEditor.height(), |
| 233 | scroll, topPos; |
234 | | adjust(); |
| 235 | if ( iframeHeight > textareaHeight && ( windowPos + heights.windowHeight ) > ( textareaHeight + $textEditor.offset().top ) ) { |
| 236 | scroll = iframeHeight - textareaHeight - 1; |
| 237 | topPos = $textEditor.parent().offset().top - heights.toolsHeight - heights.adminBarHeight; |
| 238 | |
| 239 | if ( windowPos - scroll < topPos ) { |
| 240 | window.scrollTo( window.pageXOffset, topPos ); |
| 241 | } else { |
| 242 | window.scrollBy( 0, -scroll ); |
| 243 | } |
| 244 | |
| 245 | adjust(); |
| 246 | window.scrollBy( 0, 1 ); |
| 247 | } else if ( wrapHeight && windowPos > wrapHeight ) { |
| 248 | window.scrollTo( window.pageXOffset, wrapHeight - 1 ); |
| 249 | } |
| 250 | |
| 251 | adjust(); |
| 252 | }, 200 ); |