Ticket #28328: 28328.20.patch
File 28328.20.patch, 3.9 KB (added by , 10 years ago) |
---|
-
src/wp-admin/js/editor-expand.js
22 22 mceUnbind = function(){}, 23 23 fixedTop = false, 24 24 fixedBottom = false, 25 scrollTimer; 25 scrollTimer, 26 pageYOffsetAtTop = 130, 27 textEditorClonePaddingTop = 37, 28 autoresizeMinHeight = $window.height() - 310; 26 29 27 30 $textEditorClone.insertAfter( $textEditor ); 28 31 … … 31 34 'font-size': $textEditor.css( 'font-size' ), 32 35 'line-height': $textEditor.css( 'line-height' ), 33 36 'padding': $textEditor.css( 'padding' ), 34 'padding-top': 37,37 'padding-top': textEditorClonePaddingTop, 35 38 'white-space': 'pre-wrap', 36 39 'word-wrap': 'break-word' 37 40 } ); … … 88 91 89 92 hiddenHeight = $textEditorClone.height(); 90 93 91 if ( hiddenHeight < 300) {92 hiddenHeight = 300;94 if ( hiddenHeight < autoresizeMinHeight ) { 95 hiddenHeight = autoresizeMinHeight; 93 96 } 94 97 95 98 if ( hiddenHeight === textEditorHeight ) { … … 112 115 mceEditor = editor; 113 116 114 117 // Set the minimum height to the initial viewport height. 115 editor.settings.autoresize_min_height = 300;118 editor.settings.autoresize_min_height = autoresizeMinHeight; 116 119 117 120 // Get the necessary UI elements. 118 121 $visualTop = $contentWrap.find( '.mce-toolbar-grp' ); … … 218 221 adminBarHeight = windowWidth > 600 ? $adminBar.height() : 0, 219 222 resize = type !== 'scroll', 220 223 visual = ( mceEditor && ! mceEditor.isHidden() ), 221 buffer = 200,224 buffer = autoresizeMinHeight + adminBarHeight, 222 225 $top, $editor, 223 226 toolsHeight, topPos, topHeight, editorPos, editorHeight, editorWidth, statusBarHeight; 224 227 … … 236 239 editorPos = $editor.offset().top; 237 240 editorHeight = $editor.outerHeight(); 238 241 editorWidth = $editor.outerWidth(); 242 borderWidth = 1; 239 243 statusBarHeight = visual ? $statusBar.outerHeight() : 0; 240 244 241 245 // Maybe pin the top. … … 256 260 $tools.css( { 257 261 position: 'fixed', 258 262 top: adminBarHeight, 259 width: editorWidth + 2263 width: editorWidth + ( borderWidth * 2 ) 260 264 } ); 261 265 // Maybe unpin the top. 262 266 } else if ( fixedTop || resize ) { … … 287 291 288 292 $tools.css( { 289 293 position: 'absolute', 290 top: editorHeight - buffer + 1, // border294 top: editorHeight - buffer + borderWidth, // border 291 295 width: $contentWrap.width() 292 296 } ); 293 297 } … … 295 299 296 300 // Maybe adjust the bottom bar. 297 301 if ( ( ! fixedBottom || resize ) && 298 // + 1for the border around the .wp-editor-container.299 ( windowPos + windowHeight ) <= ( editorPos + editorHeight + bottomHeight + statusBarHeight + 1) ) {302 // +[n] for the border around the .wp-editor-container. 303 ( windowPos + windowHeight ) <= ( editorPos + editorHeight + bottomHeight + statusBarHeight + borderWidth ) ) { 300 304 fixedBottom = true; 301 305 302 306 $bottom.css( { 303 307 position: 'fixed', 304 308 bottom: 0, 305 width: editorWidth + 2,309 width: editorWidth + ( borderWidth * 2 ), 306 310 borderTop: '1px solid #dedede' 307 311 } ); 308 312 } else if ( ( fixedBottom || resize ) && 309 ( windowPos + windowHeight ) > ( editorPos + editorHeight + bottomHeight + statusBarHeight - 1) ) {313 ( windowPos + windowHeight ) > ( editorPos + editorHeight + bottomHeight + statusBarHeight - borderWidth ) ) { 310 314 fixedBottom = false; 311 315 312 316 $bottom.css( { … … 354 358 function on() { 355 359 // Scroll to the top when triggering this from JS. 356 360 // Ensures toolbars are pinned properly. 357 if ( window.pageYOffset && window.pageYOffset > 130) {361 if ( window.pageYOffset && window.pageYOffset > pageYOffsetAtTop ) { 358 362 window.scrollTo( window.pageXOffset, 0 ); 359 363 } 360 364 … … 397 401 398 402 // Scroll to the top when triggering this from JS. 399 403 // Ensures toolbars are reset properly. 400 if ( window.pageYOffset && window.pageYOffset > 130) {404 if ( window.pageYOffset && window.pageYOffset > pageYOffsetAtTop ) { 401 405 window.scrollTo( window.pageXOffset, 0 ); 402 406 } 403 407