Ticket #28328: 28328.29.patch
File 28328.29.patch, 9.8 KB (added by , 10 years ago) |
---|
-
src/wp-admin/css/common.css
2255 2255 right: 0; 2256 2256 left: 0; 2257 2257 min-height: 100%; 2258 min-height: -webkit-calc( 100% - 346px ); 2258 2259 min-height: calc( 100% - 346px ); 2259 2260 } 2260 2261 -
src/wp-admin/css/edit.css
405 405 } 406 406 /* end editor-expand.js override */ 407 407 408 #poststuff #post-body.columns-2 #side-sortables { 409 min-width: 280px; 410 } 411 408 412 #timestampdiv select { 409 413 height: 21px; 410 414 line-height: 14px; -
src/wp-admin/js/editor-expand.js
16 16 $textEditorClone = $( '<div id="content-textarea-clone"></div>' ), 17 17 $bottom = $( '#post-status-info' ), 18 18 $statusBar, 19 $sideSortables = $( '#side-sortables' ), 20 $postboxContainer = $( '#postbox-container-1' ), 21 $postBody = $('#post-body'), 19 22 fullscreen = window.wp.editor && window.wp.editor.fullscreen, 20 23 mceEditor, 21 24 mceBind = function(){}, … … 22 25 mceUnbind = function(){}, 23 26 fixedTop = false, 24 27 fixedBottom = false, 25 scrollTimer; 28 fixedSideTop = false, 29 fixedSideBottom = false, 30 scrollTimer, 31 lastScrollPosition = 0, 32 pageYOffsetAtTop = 130, 33 pinnedToolsTop = 56, // also used in CSS for the "#poststuff #post-body #postbox-container-1.pinned" selector 34 textEditorClonePaddingTop = 37, 35 autoresizeMinHeight = 300; // $window.height() - 310; 26 36 27 37 $textEditorClone.insertAfter( $textEditor ); 28 38 … … 31 41 'font-size': $textEditor.css( 'font-size' ), 32 42 'line-height': $textEditor.css( 'line-height' ), 33 43 'padding': $textEditor.css( 'padding' ), 34 'padding-top': 37,44 'padding-top': textEditorClonePaddingTop, 35 45 'white-space': 'pre-wrap', 36 46 'word-wrap': 'break-word' 37 47 } ); … … 88 98 89 99 hiddenHeight = $textEditorClone.height(); 90 100 91 if ( hiddenHeight < 300) {92 hiddenHeight = 300;101 if ( hiddenHeight < autoresizeMinHeight ) { 102 hiddenHeight = autoresizeMinHeight; 93 103 } 94 104 95 105 if ( hiddenHeight === textEditorHeight ) { … … 112 122 mceEditor = editor; 113 123 114 124 // Set the minimum height to the initial viewport height. 115 editor.settings.autoresize_min_height = 300;125 editor.settings.autoresize_min_height = autoresizeMinHeight; 116 126 117 127 // Get the necessary UI elements. 118 128 $visualTop = $contentWrap.find( '.mce-toolbar-grp' ); … … 218 228 adminBarHeight = windowWidth > 600 ? $adminBar.height() : 0, 219 229 resize = type !== 'scroll', 220 230 visual = ( mceEditor && ! mceEditor.isHidden() ), 221 buffer = 200, 222 $top, $editor, 231 buffer = autoresizeMinHeight + adminBarHeight, 232 postBodyTop = $postBody.offset().top, 233 borderWidth = 1, 234 contentWrapWidth = $contentWrap.width(), 235 sideSortablesHeight = $sideSortables.height(), 236 $top, $editor, _top, 223 237 toolsHeight, topPos, topHeight, editorPos, editorHeight, editorWidth, statusBarHeight; 224 238 225 239 if ( visual ) { … … 238 252 editorWidth = $editor.outerWidth(); 239 253 statusBarHeight = visual ? $statusBar.outerHeight() : 0; 240 254 255 241 256 // Maybe pin the top. 242 257 if ( ( ! fixedTop || resize ) && 243 // Handle scrolling down. 244 ( windowPos >= ( topPos - toolsHeight - adminBarHeight ) && 245 // Handle scrolling up. 246 windowPos <= ( topPos - toolsHeight - adminBarHeight + editorHeight - buffer ) ) ) { 258 // Handle scrolling down. 259 ( windowPos >= ( topPos - toolsHeight - adminBarHeight ) && 260 // Handle scrolling up. 261 windowPos <= ( topPos - toolsHeight - adminBarHeight + editorHeight - buffer ) ) ) { 262 247 263 fixedTop = true; 248 264 249 265 $top.css( { 250 266 position: 'fixed', 251 267 top: adminBarHeight + toolsHeight, 252 width: $editor.parent().width() - ( $top.outerWidth() - $top.width() ),268 width: contentWrapWidth - ( borderWidth * 2 ) - ( visual ? 0 : ( $top.outerWidth() - $top.width() ) ), 253 269 borderTop: '1px solid #e5e5e5' 254 270 } ); 255 271 … … 256 272 $tools.css( { 257 273 position: 'fixed', 258 274 top: adminBarHeight, 259 width: editorWidth + 2275 width: contentWrapWidth 260 276 } ); 261 277 // Maybe unpin the top. 262 278 } else if ( fixedTop || resize ) { … … 268 284 position: 'absolute', 269 285 top: 0, 270 286 borderTop: 'none', 271 width: $editor.parent().width() - ( $top.outerWidth() - $top.width() )287 width: contentWrapWidth - ( borderWidth * 2 ) - ( visual ? 0 : ( $top.outerWidth() - $top.width() ) ) 272 288 } ); 273 289 274 290 $tools.css( { 275 291 position: 'absolute', 276 292 top: 0, 277 width: $contentWrap.width()293 width: contentWrapWidth 278 294 } ); 279 295 // Handle scrolling down. 280 296 } else if ( windowPos >= ( topPos - toolsHeight - adminBarHeight + editorHeight - buffer ) ) { … … 282 298 283 299 $top.css( { 284 300 position: 'absolute', 285 top: editorHeight - buffer 301 top: editorHeight - buffer, 302 width: contentWrapWidth - ( borderWidth * 2 ) - ( visual ? 0 : ( $top.outerWidth() - $top.width() ) ) 286 303 } ); 287 304 288 305 $tools.css( { 289 306 position: 'absolute', 290 top: editorHeight - buffer + 1, // border291 width: $contentWrap.width()307 top: editorHeight - buffer + borderWidth, // border 308 width: contentWrapWidth 292 309 } ); 293 310 } 294 311 } … … 295 312 296 313 // Maybe adjust the bottom bar. 297 314 if ( ( ! fixedBottom || resize ) && 298 // + 1 for the border around the .wp-editor-container. 299 ( windowPos + windowHeight ) <= ( editorPos + editorHeight + bottomHeight + statusBarHeight + 1 ) ) { 315 // +[n] for the border around the .wp-editor-container. 316 ( windowPos + windowHeight ) <= ( editorPos + editorHeight + bottomHeight + statusBarHeight + borderWidth ) ) { 317 300 318 fixedBottom = true; 301 319 302 320 $bottom.css( { 303 321 position: 'fixed', 304 322 bottom: 0, 305 width: editorWidth + 2,323 width: editorWidth + ( borderWidth * 2 ), 306 324 borderTop: '1px solid #dedede' 307 325 } ); 308 326 } else if ( ( fixedBottom || resize ) && 309 ( windowPos + windowHeight ) > ( editorPos + editorHeight + bottomHeight + statusBarHeight - 1) ) {327 ( windowPos + windowHeight ) > ( editorPos + editorHeight + bottomHeight + statusBarHeight - borderWidth ) ) { 310 328 fixedBottom = false; 311 329 312 330 $bottom.css( { … … 317 335 } ); 318 336 } 319 337 338 339 if ( $postboxContainer.width() < 300 && windowWidth > 600 && // sidebar position is changed with @media from CSS 340 $document.height() > ( $sideSortables.height() + postBodyTop + 120 ) && // the sidebar is not the tallest element 341 windowHeight < editorHeight * 0.7 ) { // the editor is taller than the viewport 342 343 // Handle sidebar pinning 344 if ( sideSortablesHeight > windowHeight || fixedSideTop || fixedSideBottom ) { 345 // Reset when scrolling to the top 346 if ( windowPos + pinnedToolsTop <= postBodyTop ) { 347 $sideSortables.attr( 'style', '' ); 348 fixedSideTop = fixedSideBottom = false; 349 } else { 350 if ( windowPos > lastScrollPosition ) { 351 // Scrolling down 352 if ( fixedSideTop ) { 353 // let it scroll 354 fixedSideTop = false; 355 _top = $sideSortables.offset().top - adminBarHeight; 356 357 $sideSortables.css({ 358 position: 'absolute', 359 top: _top, 360 bottom: '' 361 }); 362 } else if ( ! fixedSideBottom && sideSortablesHeight + $sideSortables.offset().top + 20 < windowPos + windowHeight ) { 363 // pin the bottom 364 fixedSideBottom = true; 365 366 $sideSortables.css({ 367 position: 'fixed', 368 top: 'auto', 369 bottom: '20px' 370 }); 371 } 372 } else if ( windowPos < lastScrollPosition ) { 373 // Scrolling up 374 if ( fixedSideBottom ) { 375 // let it scroll 376 fixedSideBottom = false; 377 _top = $sideSortables.offset().top; 378 379 $sideSortables.css({ 380 position: 'absolute', 381 top: _top, 382 bottom: '' 383 }); 384 } else if ( ! fixedSideTop && $sideSortables.offset().top >= windowPos + pinnedToolsTop ) { 385 // pin the top 386 fixedSideTop = true; 387 388 $sideSortables.css({ 389 position: 'fixed', 390 top: pinnedToolsTop, 391 bottom: '' 392 }); 393 } 394 } 395 } 396 } else { 397 // if the sidebar container is smaller than the viewport, then pin/unpin the top when scrolling 398 if ( windowPos >= ( postBodyTop - pinnedToolsTop ) ) { 399 $sideSortables.css( { 400 position: 'fixed', 401 top: pinnedToolsTop 402 } ); 403 } else { 404 $sideSortables.css( { 405 position: '', 406 top: '' 407 } ); 408 } 409 410 fixedSideTop = fixedSideBottom = false; 411 } 412 413 lastScrollPosition = windowPos; 414 } 415 320 416 if ( resize ) { 321 417 $contentWrap.css( { 322 418 paddingTop: $tools.outerHeight() … … 354 450 function on() { 355 451 // Scroll to the top when triggering this from JS. 356 452 // Ensures toolbars are pinned properly. 357 if ( window.pageYOffset && window.pageYOffset > 130) {453 if ( window.pageYOffset && window.pageYOffset > pageYOffsetAtTop ) { 358 454 window.scrollTo( window.pageXOffset, 0 ); 359 455 } 360 456 … … 397 493 398 494 // Scroll to the top when triggering this from JS. 399 495 // Ensures toolbars are reset properly. 400 if ( window.pageYOffset && window.pageYOffset > 130) {496 if ( window.pageYOffset && window.pageYOffset > pageYOffsetAtTop ) { 401 497 window.scrollTo( window.pageXOffset, 0 ); 402 498 } 403 499 -
src/wp-includes/js/media-grid.js
1 /* global _wpMediaViewsL10n, MediaElementPlayer, _wpMediaGridSettings , confirm*/1 /* global _wpMediaViewsL10n, MediaElementPlayer, _wpMediaGridSettings */ 2 2 (function($, _, Backbone, wp) { 3 3 // Local reference to the WordPress media namespace. 4 4 var media = wp.media, l10n;