Ticket #28328: 28328.28.patch
File 28328.28.patch, 9.9 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 #postbox-container-1.pinned { 409 position: fixed; 410 margin: 0; 411 top: 56px; 412 bottom: 0; 413 right: 20px; 414 -webkit-transition: top 200ms; 415 transition: top 200ms; 416 } 417 418 #postbox-container-1 #side-sortables { 419 padding-bottom: 1px; 420 } 421 408 422 #timestampdiv select { 409 423 height: 21px; 410 424 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'), 22 $wpfooter = $( '#wpfooter' ), 19 23 fullscreen = window.wp.editor && window.wp.editor.fullscreen, 20 24 mceEditor, 21 25 mceBind = function(){}, … … 22 26 mceUnbind = function(){}, 23 27 fixedTop = false, 24 28 fixedBottom = false, 25 scrollTimer; 29 fixedSide = false, 30 scrolledSide = false, 31 scrollTimer, 32 justFixedSide = false, 33 justFixedSideTimer, 34 lastScrollPosition = 0, 35 pageYOffsetAtTop = 130, 36 pinnedToolsTop = 56, // also used in CSS for the "#poststuff #post-body #postbox-container-1.pinned" selector 37 textEditorClonePaddingTop = 37, 38 autoresizeMinHeight = 300; // $window.height() - 310; 26 39 27 40 $textEditorClone.insertAfter( $textEditor ); 28 41 … … 31 44 'font-size': $textEditor.css( 'font-size' ), 32 45 'line-height': $textEditor.css( 'line-height' ), 33 46 'padding': $textEditor.css( 'padding' ), 34 'padding-top': 37,47 'padding-top': textEditorClonePaddingTop, 35 48 'white-space': 'pre-wrap', 36 49 'word-wrap': 'break-word' 37 50 } ); … … 88 101 89 102 hiddenHeight = $textEditorClone.height(); 90 103 91 if ( hiddenHeight < 300) {92 hiddenHeight = 300;104 if ( hiddenHeight < autoresizeMinHeight ) { 105 hiddenHeight = autoresizeMinHeight; 93 106 } 94 107 95 108 if ( hiddenHeight === textEditorHeight ) { … … 112 125 mceEditor = editor; 113 126 114 127 // Set the minimum height to the initial viewport height. 115 editor.settings.autoresize_min_height = 300;128 editor.settings.autoresize_min_height = autoresizeMinHeight; 116 129 117 130 // Get the necessary UI elements. 118 131 $visualTop = $contentWrap.find( '.mce-toolbar-grp' ); … … 218 231 adminBarHeight = windowWidth > 600 ? $adminBar.height() : 0, 219 232 resize = type !== 'scroll', 220 233 visual = ( mceEditor && ! mceEditor.isHidden() ), 221 buffer = 200, 234 buffer = autoresizeMinHeight + adminBarHeight, 235 postBodyTop = $postBody.offset().top, 236 borderWidth = 1, 237 contentWrapWidth = $contentWrap.width(), 222 238 $top, $editor, 223 toolsHeight, topPos, topHeight, editorPos, editorHeight, editorWidth, statusBarHeight ;239 toolsHeight, topPos, topHeight, editorPos, editorHeight, editorWidth, statusBarHeight, sideScrollTrigger; 224 240 225 241 if ( visual ) { 226 242 $top = $visualTop; … … 238 254 editorWidth = $editor.outerWidth(); 239 255 statusBarHeight = visual ? $statusBar.outerHeight() : 0; 240 256 257 241 258 // Maybe pin the top. 242 259 if ( ( ! fixedTop || resize ) && 243 // Handle scrolling down. 244 ( windowPos >= ( topPos - toolsHeight - adminBarHeight ) && 245 // Handle scrolling up. 246 windowPos <= ( topPos - toolsHeight - adminBarHeight + editorHeight - buffer ) ) ) { 260 // Handle scrolling down. 261 ( windowPos >= ( topPos - toolsHeight - adminBarHeight ) && 262 // Handle scrolling up. 263 windowPos <= ( topPos - toolsHeight - adminBarHeight + editorHeight - buffer ) ) ) { 264 247 265 fixedTop = true; 248 266 249 267 $top.css( { 250 268 position: 'fixed', 251 269 top: adminBarHeight + toolsHeight, 252 width: $editor.parent().width() - ( $top.outerWidth() - $top.width() ),270 width: contentWrapWidth - ( borderWidth * 2 ) - ( visual ? 0 : ( $top.outerWidth() - $top.width() ) ), 253 271 borderTop: '1px solid #e5e5e5' 254 272 } ); 255 273 … … 256 274 $tools.css( { 257 275 position: 'fixed', 258 276 top: adminBarHeight, 259 width: editorWidth + 2277 width: contentWrapWidth 260 278 } ); 261 279 // Maybe unpin the top. 262 280 } else if ( fixedTop || resize ) { … … 268 286 position: 'absolute', 269 287 top: 0, 270 288 borderTop: 'none', 271 width: $editor.parent().width() - ( $top.outerWidth() - $top.width() )289 width: contentWrapWidth - ( borderWidth * 2 ) - ( visual ? 0 : ( $top.outerWidth() - $top.width() ) ) 272 290 } ); 273 291 274 292 $tools.css( { 275 293 position: 'absolute', 276 294 top: 0, 277 width: $contentWrap.width()295 width: contentWrapWidth 278 296 } ); 279 297 // Handle scrolling down. 280 298 } else if ( windowPos >= ( topPos - toolsHeight - adminBarHeight + editorHeight - buffer ) ) { … … 282 300 283 301 $top.css( { 284 302 position: 'absolute', 285 top: editorHeight - buffer 303 top: editorHeight - buffer, 304 width: contentWrapWidth - ( borderWidth * 2 ) - ( visual ? 0 : ( $top.outerWidth() - $top.width() ) ) 286 305 } ); 287 306 288 307 $tools.css( { 289 308 position: 'absolute', 290 top: editorHeight - buffer + 1, // border291 width: $contentWrap.width()309 top: editorHeight - buffer + borderWidth, // border 310 width: contentWrapWidth 292 311 } ); 293 312 } 294 313 } … … 295 314 296 315 // Maybe adjust the bottom bar. 297 316 if ( ( ! fixedBottom || resize ) && 298 // + 1 for the border around the .wp-editor-container. 299 ( windowPos + windowHeight ) <= ( editorPos + editorHeight + bottomHeight + statusBarHeight + 1 ) ) { 317 // +[n] for the border around the .wp-editor-container. 318 ( windowPos + windowHeight ) <= ( editorPos + editorHeight + bottomHeight + statusBarHeight + borderWidth ) ) { 319 300 320 fixedBottom = true; 301 321 302 322 $bottom.css( { 303 323 position: 'fixed', 304 324 bottom: 0, 305 width: editorWidth + 2,325 width: editorWidth + ( borderWidth * 2 ), 306 326 borderTop: '1px solid #dedede' 307 327 } ); 308 328 } else if ( ( fixedBottom || resize ) && 309 ( windowPos + windowHeight ) > ( editorPos + editorHeight + bottomHeight + statusBarHeight - 1) ) {329 ( windowPos + windowHeight ) > ( editorPos + editorHeight + bottomHeight + statusBarHeight - borderWidth ) ) { 310 330 fixedBottom = false; 311 331 312 332 $bottom.css( { … … 317 337 } ); 318 338 } 319 339 340 // The sidebar is on the left and the scrolling height is large enough, pin it. 341 if ( $postboxContainer.width() < 300 && windowWidth > 600 && // sidebar position is changed with @media from CSS 342 $document.height() > ( $sideSortables.height() + postBodyTop + 120 ) && // the sidebar is not the tallest element 343 windowHeight < editorHeight / 2 ) { // the editor is twice as tall as the viewport 344 345 if ( ! fixedSide && ( postBodyTop - pinnedToolsTop ) < windowPos ) { 346 fixedSide = justFixedSide = true; 347 $postboxContainer.addClass( 'pinned' ); 348 } else if ( fixedSide ) { 349 if ( ( postBodyTop - pinnedToolsTop ) >= windowPos ) { 350 fixedSide = false; 351 $postboxContainer.removeClass( 'pinned' ); 352 } 353 } 354 355 if ( windowPos > lastScrollPosition ) { 356 // Scrolling down 357 if ( fixedSide ) { 358 if ( justFixedSide && windowPos + windowHeight + 20 > $wpfooter.offset().top ) { 359 justFixedSide = false; 360 } 361 362 if ( justFixedSide ) { 363 clearTimeout( justFixedSideTimer ); 364 justFixedSideTimer = setTimeout( function() { 365 justFixedSide = false; 366 }, 400 ); 367 } else { 368 sideScrollTrigger = ( $sideSortables.height() - ( windowHeight - pinnedToolsTop ) ); 369 370 if ( ! scrolledSide && sideScrollTrigger > 1 && windowPos > sideScrollTrigger && windowPos > $wrap.offset().top ) { 371 scrolledSide = true; 372 $postboxContainer.css( 'top', -( sideScrollTrigger - ( pinnedToolsTop - 20 ) ) ); 373 // 20 is additional distance from the bottom of the sidebar to the bottom of the window 374 } 375 } 376 } 377 } else if ( windowPos < lastScrollPosition ) { 378 // Scrolling up 379 if ( scrolledSide && ( fixedBottom || ( windowPos + windowHeight + 40 ) < $wpfooter.offset().top ) ) { 380 scrolledSide = false; 381 $postboxContainer.css( 'top', '' ); 382 } 383 384 justFixedSide = false; 385 } 386 387 lastScrollPosition = windowPos; 388 } else { 389 // Unpin 390 $postboxContainer.removeClass( 'pinned' ); 391 $postboxContainer.css( 'top', '' ); 392 scrolledSide = fixedSide = false; 393 } 394 320 395 if ( resize ) { 321 396 $contentWrap.css( { 322 397 paddingTop: $tools.outerHeight() … … 354 429 function on() { 355 430 // Scroll to the top when triggering this from JS. 356 431 // Ensures toolbars are pinned properly. 357 if ( window.pageYOffset && window.pageYOffset > 130) {432 if ( window.pageYOffset && window.pageYOffset > pageYOffsetAtTop ) { 358 433 window.scrollTo( window.pageXOffset, 0 ); 359 434 } 360 435 … … 397 472 398 473 // Scroll to the top when triggering this from JS. 399 474 // Ensures toolbars are reset properly. 400 if ( window.pageYOffset && window.pageYOffset > 130) {475 if ( window.pageYOffset && window.pageYOffset > pageYOffsetAtTop ) { 401 476 window.scrollTo( window.pageXOffset, 0 ); 402 477 } 403 478 -
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;