Ticket #29293: 29293.4.patch
File 29293.4.patch, 8.8 KB (added by , 10 years ago) |
---|
-
src/wp-admin/js/editor-expand.js
10 10 $wrap = $( '#postdivrich' ), 11 11 $contentWrap = $( '#wp-content-wrap' ), 12 12 $tools = $( '#wp-content-editor-tools' ), 13 $visualTop ,14 $visualEditor ,13 $visualTop = $(), 14 $visualEditor = $(), 15 15 $textTop = $( '#ed_toolbar' ), 16 16 $textEditor = $( '#content' ), 17 17 $textEditorClone = $( '<div id="content-textarea-clone"></div>' ), 18 18 $bottom = $( '#post-status-info' ), 19 $statusBar, 19 $menuBar = $(), 20 $statusBar = $(), 20 21 $sideSortables = $( '#side-sortables' ), 21 22 $postboxContainer = $( '#postbox-container-1' ), 22 23 $postBody = $('#post-body'), … … 125 126 // Get the necessary UI elements. 126 127 $visualTop = $contentWrap.find( '.mce-toolbar-grp' ); 127 128 $visualEditor = $contentWrap.find( '.mce-edit-area' ); 128 $statusBar = $contentWrap.find( '.mce-statusbar' ).filter( ':visible' ); 129 $statusBar = $contentWrap.find( '.mce-statusbar' ); 130 $menuBar = $contentWrap.find( '.mce-menubar' ); 129 131 130 132 function mceGetCursorOffset() { 131 133 var node = editor.selection.getNode(), … … 162 164 cursorBottom = cursorTop + offset.height; 163 165 cursorTop = cursorTop - buffer; 164 166 cursorBottom = cursorBottom + buffer; 165 editorTop = $adminBar.outerHeight() + $tools.outerHeight() + $ visualTop.outerHeight();166 editorBottom = windowHeight - $bottom.outerHeight() ;167 editorTop = $adminBar.outerHeight() + $tools.outerHeight() + $menuBar.outerHeight() + $visualTop.outerHeight(); 168 editorBottom = windowHeight - $bottom.outerHeight() - $statusBar.outerHeight(); 167 169 168 170 // Don't scroll if the node is taller than the visible part of the editor 169 171 if ( editorBottom - editorTop < offset.height ) { … … 232 234 contentWrapWidth = $contentWrap.width(), 233 235 sideSortablesHeight = $sideSortables.height(), 234 236 $top, $editor, sidebarTop, footerTop, canPin, 235 toolsHeight, topPos, topHeight, editorPos, editorHeight, statusBarHeight;237 toolsHeight, topPos, topHeight, editorPos, editorHeight, menuBarHeight, statusBarHeight; 236 238 237 239 if ( visual ) { 238 240 $top = $visualTop; … … 247 249 topHeight = $top.outerHeight(); 248 250 editorPos = $editor.offset().top; 249 251 editorHeight = $editor.outerHeight(); 250 statusBarHeight = visual ? $statusBar.outerHeight() : 0; 252 menuBarHeight = $menuBar.outerHeight(); 253 statusBarHeight = $statusBar.outerHeight(); 251 254 252 255 // Should we pin? 253 256 canPin = visual ? autoresizeMinHeight + topHeight : autoresizeMinHeight + 20; // 20px from textarea padding … … 255 258 256 259 if ( ! canPin ) { 257 260 if ( resize ) { 258 $to p.css( {261 $tools.css( { 259 262 position: 'absolute', 260 263 top: 0, 261 borderTop: 'none', 262 width: contentWrapWidth - ( borderWidth * 2 ) - ( visual ? 0 : ( $top.outerWidth() - $top.width() ) ) 264 width: contentWrapWidth 263 265 } ); 264 266 265 $ tools.css( {267 $menuBar.css( { 266 268 position: 'absolute', 267 269 top: 0, 268 width: contentWrapWidth 270 width: contentWrapWidth - ( borderWidth * 2 ) - ( visual ? 0 : ( $top.outerWidth() - $top.width() ) ) 269 271 } ); 270 272 271 $bottom.css( { 272 position: 'relative', 273 bottom: 'auto', 274 width: '100%', 275 borderTop: 'none' 273 $top.css( { 274 position: 'absolute', 275 top: 0 + menuBarHeight, 276 width: contentWrapWidth - ( borderWidth * 2 ) - ( visual ? 0 : ( $top.outerWidth() - $top.width() ) ) 276 277 } ); 278 279 $statusBar.add( $bottom ).attr( 'style', '' ); 277 280 } 278 281 } else { 279 282 // Maybe pin the top. 280 283 if ( ( ! fixedTop || resize ) && 281 // Handle scrolling down. 282 ( windowPos >= ( topPos - toolsHeight - adminBarHeight ) && 283 // Handle scrolling up. 284 windowPos <= ( topPos - toolsHeight - adminBarHeight + editorHeight - buffer ) ) ) { 285 284 // Handle scrolling down. 285 ( windowPos >= ( topPos - toolsHeight - adminBarHeight ) && 286 // Handle scrolling up. 287 windowPos <= ( topPos - toolsHeight - adminBarHeight + editorHeight - buffer ) ) ) { 286 288 fixedTop = true; 287 289 288 $top.css( { 290 $tools.css( { 291 position: 'fixed', 292 top: adminBarHeight, 293 width: contentWrapWidth, 294 borderBottom: '1px solid #dedede' 295 } ); 296 297 $menuBar.css( { 289 298 position: 'fixed', 290 299 top: adminBarHeight + toolsHeight, 291 width: contentWrapWidth - ( borderWidth * 2 ) - ( visual ? 0 : ( $top.outerWidth() - $top.width() ) ), 292 borderTop: '1px solid #e5e5e5' 300 width: contentWrapWidth - ( borderWidth * 2 ) - ( visual ? 0 : ( $top.outerWidth() - $top.width() ) ) 293 301 } ); 294 302 295 $to ols.css( {303 $top.css( { 296 304 position: 'fixed', 297 top: adminBarHeight ,298 width: contentWrapWidth 305 top: adminBarHeight + toolsHeight + menuBarHeight, 306 width: contentWrapWidth - ( borderWidth * 2 ) - ( visual ? 0 : ( $top.outerWidth() - $top.width() ) ) 299 307 } ); 300 308 // Maybe unpin the top. 301 309 } else if ( fixedTop || resize ) { … … 303 311 if ( windowPos <= ( topPos - toolsHeight - adminBarHeight ) ) { 304 312 fixedTop = false; 305 313 306 $to p.css( {314 $tools.css( { 307 315 position: 'absolute', 308 316 top: 0, 309 borderTop: 'none',310 width: contentWrapWidth - ( borderWidth * 2 ) - ( visual ? 0 : ( $top.outerWidth() - $top.width() ) )317 width: contentWrapWidth, 318 borderBottom: '' 311 319 } ); 312 320 313 $ tools.css( {321 $menuBar.css( { 314 322 position: 'absolute', 315 323 top: 0, 316 width: contentWrapWidth 324 width: contentWrapWidth - ( borderWidth * 2 ) - ( visual ? 0 : ( $top.outerWidth() - $top.width() ) ) 325 } ); 326 327 $top.css( { 328 position: 'absolute', 329 top: 0 + menuBarHeight, 330 width: contentWrapWidth - ( borderWidth * 2 ) - ( visual ? 0 : ( $top.outerWidth() - $top.width() ) ) 317 331 } ); 318 332 // Handle scrolling down. 319 333 } else if ( windowPos >= ( topPos - toolsHeight - adminBarHeight + editorHeight - buffer ) ) { 320 334 fixedTop = false; 321 335 322 $top.css( { 336 $tools.css( { 337 position: 'absolute', 338 top: editorHeight - buffer + borderWidth, // border 339 width: contentWrapWidth, 340 borderBottom: '1px solid #dedede' 341 } ); 342 343 $menuBar.css( { 323 344 position: 'absolute', 324 345 top: editorHeight - buffer, 325 346 width: contentWrapWidth - ( borderWidth * 2 ) - ( visual ? 0 : ( $top.outerWidth() - $top.width() ) ) 326 347 } ); 327 348 328 $to ols.css( {349 $top.css( { 329 350 position: 'absolute', 330 top: editorHeight - buffer + borderWidth, // border331 width: contentWrapWidth 351 top: editorHeight - buffer + menuBarHeight, 352 width: contentWrapWidth - ( borderWidth * 2 ) - ( visual ? 0 : ( $top.outerWidth() - $top.width() ) ) 332 353 } ); 333 354 } 334 355 } 335 356 336 357 // Maybe adjust the bottom bar. 337 358 if ( ( ! fixedBottom || resize ) && 338 // +[n] for the border around the .wp-editor-container. 339 ( windowPos + windowHeight ) <= ( editorPos + editorHeight + bottomHeight + statusBarHeight + borderWidth ) ) { 340 359 // +[n] for the border around the .wp-editor-container. 360 ( windowPos + windowHeight ) <= ( editorPos + editorHeight + bottomHeight + statusBarHeight + borderWidth ) ) { 341 361 fixedBottom = true; 342 362 363 $statusBar.css( { 364 position: 'fixed', 365 bottom: bottomHeight, 366 width: contentWrapWidth - ( borderWidth * 2 ), 367 borderBottom: '1px solid #dedede' 368 } ); 369 343 370 $bottom.css( { 344 371 position: 'fixed', 345 372 bottom: 0, 346 373 width: contentWrapWidth, 347 borderTop: '1px solid #dedede'374 borderTop: visual ? 'none' : '1px solid #dedede' 348 375 } ); 349 376 } else if ( ( fixedBottom || resize ) && 350 377 ( windowPos + windowHeight ) > ( editorPos + editorHeight + bottomHeight + statusBarHeight - borderWidth ) ) { 351 378 fixedBottom = false; 352 379 353 $bottom.css( { 354 position: 'relative', 355 bottom: 'auto', 356 width: '100%', 357 borderTop: 'none' 358 } ); 380 $statusBar.add( $bottom ).attr( 'style', '' ); 359 381 } 360 382 } 361 383 … … 455 477 456 478 if ( visual ) { 457 479 $visualEditor.css( { 458 paddingTop: $visualTop.outerHeight() 480 paddingTop: $visualTop.outerHeight() + menuBarHeight 459 481 } ); 460 482 } else { 461 483 $textEditor.css( { … … 554 576 fullscreen && fullscreen.pubsub.unsubscribe( 'hidden', fullscreenHide ); 555 577 556 578 // Reset all css 557 $.each( [ $visualTop, $textTop, $tools, $ bottom, $contentWrap, $visualEditor, $textEditor, $sideSortables ], function( i, element ) {579 $.each( [ $visualTop, $textTop, $tools, $menuBar, $bottom, $statusBar, $contentWrap, $visualEditor, $textEditor, $sideSortables ], function( i, element ) { 558 580 element && element.attr( 'style', '' ); 559 581 }); 560 582 -
src/wp-includes/css/editor.css
368 368 /* Menubar */ 369 369 .mce-menubar { 370 370 border-color: #e5e5e5; 371 background: #fff; 371 372 } 372 373 373 374 .mce-menubar .mce-btn:focus {