Ticket #32757: 32757.patch
File 32757.patch, 6.7 KB (added by , 9 years ago) |
---|
-
src/wp-admin/css/press-this.css
390 390 text-decoration: underline; 391 391 } 392 392 393 .split-button { 394 position: relative; 395 display: inline-block; 396 } 393 397 398 .split-button-body { 399 display: none; 400 position: absolute; 401 bottom: 35px; 402 right: 0; 403 border: 1px solid #ddd; 404 background-color: #fff; 405 min-width: 160px; 406 max-width: 100%; 407 padding: 5px; 408 } 409 410 .split-button-body .split-button-option { 411 display: block; 412 padding: 4px 10px; 413 margin: 0; 414 width: 100%; 415 text-align: left; 416 } 417 418 .is-open .split-button-body { 419 display: block; 420 } 421 422 .split-button-head { 423 background: #00a0d2; 424 border-color: #0073aa; 425 box-shadow: inset 0 1px 0 rgba( 120, 200, 230, 0.5 ), 0 1px 0 rgba( 0, 0, 0, 0.15 ); 426 margin: 0; 427 padding: 3px; 428 cursor: pointer; 429 border-width: 1px; 430 border-style: solid; 431 -webkit-border-radius: 3px; 432 border-radius: 3px; 433 } 434 435 .split-button-head:hover { 436 background: #0091cd; 437 border-color: #0073aa; 438 -webkit-box-shadow: inset 0 1px 0 rgba( 120, 200, 230, 0.6 ); 439 box-shadow: inset 0 1px 0 rgba( 120, 200, 230, 0.6 ); 440 } 441 442 .split-button-primary, 443 .split-button-arrow { 444 color: #fff; 445 white-space: nowrap; 446 border-radius: 0; 447 line-height: 1.5; 448 } 449 450 .split-button-primary:hover, 451 .split-button-arrow:hover, 452 .split-button-primary:focus, 453 .split-button-arrow:focus { 454 color: #fff; 455 } 456 457 .split-button-arrow { 458 border-left: 1px solid #fff; 459 } 460 394 461 /** 395 462 * Forms 396 463 * … … 1753 1820 padding: 0 10px; 1754 1821 } 1755 1822 1756 .draft-button.is-hidden,1757 .draft-button .saving-draft,1758 .draft-button.is-saving .save-draft {1759 display: none;1760 }1761 1762 .draft-button.is-saving .saving-draft {1763 display: inline;1764 }1765 1766 1823 /* TinyMCE styles */ 1767 1824 .editor .wp-media-buttons { 1768 1825 float: none; -
src/wp-admin/includes/class-wp-press-this.php
1449 1449 </div> 1450 1450 <div class="post-actions"> 1451 1451 <span class="spinner"> </span> 1452 <button type="button" class="button-subtle draft-button" aria-live="polite"> 1453 <span class="save-draft"><?php _e( 'Save Draft' ); ?></span> 1454 <span class="saving-draft"><?php _e( 'Saving...' ); ?></span> 1455 </button> 1456 <a href="<?php echo esc_url( get_edit_post_link( $post_ID ) ); ?>" class="edit-post-link" style="display: none;" target="_blank"><?php _e( 'Standard Editor' ); ?></a> 1457 <button type="button" class="button-subtle preview-button"><?php _e( 'Preview' ); ?></button> 1458 <button type="button" class="button-primary publish-button"><?php echo ( current_user_can( 'publish_posts' ) ) ? __( 'Publish' ) : __( 'Submit for Review' ); ?></button> 1452 <div class="split-button"> 1453 <div class="split-button-body"> 1454 <button type="button" class="button-subtle draft-button split-button-option" aria-live="polite"><?php _e( 'Save Draft' ); ?></button> 1455 <a href="<?php echo esc_url( get_edit_post_link( $post_ID ) ); ?>" class="edit-post-link split-button-option" target="_blank"><?php _e( 'Standard Editor' ); ?></a> 1456 <button type="button" class="button-subtle preview-button split-button-option"><?php _e( 'Preview' ); ?></button> 1457 </div> 1458 <div class="split-button-head"> 1459 <button type="button" class="button-subtle publish-button split-button-primary"><?php echo ( current_user_can( 'publish_posts' ) ) ? __( 'Publish' ) : __( 'Submit for Review' ); ?></button> 1460 <button type="button" class="button-subtle split-button-arrow"><i class="dashicons dashicons-arrow-up-alt2"></i></button> 1461 </div> 1462 </div> 1459 1463 </div> 1460 1464 </div> 1461 1465 </form> -
src/wp-admin/js/press-this.js
6 6 var PressThis = function() { 7 7 var editor, $mediaList, $mediaThumbWrap, 8 8 saveAlert = false, 9 editLinkVisible = false,10 9 textarea = document.createElement( 'textarea' ), 11 10 sidebarIsOpen = false, 12 11 settings = window.wpPressThisConfig || {}, … … 199 198 window.location.href = response.data.redirect; 200 199 } 201 200 } else if ( response.data.postSaved ) { 202 $link = $( '.edit-post-link' ); 203 $button = $( '.draft-button' ); 204 editLinkVisible = true; 205 206 $button.fadeOut( 200, function() { 207 $button.removeClass( 'is-saving' ); 208 $link.fadeIn( 200, function() { 209 var active = document.activeElement; 210 // Different browsers move the focus to different places when the button is disabled. 211 if ( keepFocus && ( active === $button[0] || $( active ).hasClass( 'post-actions' ) || active.nodeName === 'BODY' ) ) { 212 $link.focus(); 213 } 214 }); 215 }); 201 // consider showing "Saved" message 216 202 } 217 203 }).fail( function() { 218 204 renderError( __( 'serverError' ) ); … … 219 205 }); 220 206 } 221 207 222 function resetDraftButton() {223 if ( editLinkVisible ) {224 editLinkVisible = false;225 226 $( '.edit-post-link' ).fadeOut( 200, function() {227 $( '.draft-button' ).removeClass( 'is-saving' ).fadeIn( 200 );228 });229 }230 }231 232 208 /** 233 209 * Inserts the media a user has selected from the presented list inside the editor, as an image or embed, based on type 234 210 * … … 550 526 551 527 $titleField.on( 'focus', function() { 552 528 $placeholder.addClass( 'is-hidden' ); 553 resetDraftButton();554 529 }).on( 'blur', function() { 555 530 if ( ! $titleField.text() && ! $titleField.html() ) { 556 531 $placeholder.removeClass( 'is-hidden' ); … … 653 628 654 629 editor.on( 'nodechange', function() { 655 630 hasSetFocus = true; 656 resetDraftButton();657 631 } ); 658 632 }).on( 'click.press-this keypress.press-this', '.suggested-media-thumbnail', function( event ) { 659 633 if ( event.type === 'click' || event.keyCode === 13 ) { … … 668 642 669 643 if ( $button.length ) { 670 644 if ( $button.hasClass( 'draft-button' ) ) { 671 $button.addClass( 'is-saving' );672 645 submitPost( 'draft' ); 673 646 } else if ( $button.hasClass( 'publish-button' ) ) { 674 647 submitPost( 'publish' ); … … 680 653 $( '#pressthis-form' ).attr( 'target', '_blank' ).submit().attr( 'target', '' ); 681 654 $( '#wp-preview' ).val( '' ); 682 655 } 656 657 if ( $button.hasClass( 'split-button-arrow' ) || $target.closest( '.split-button-body' ).length ) { 658 $( '.split-button' ).toggleClass( 'is-open' ); 659 } 683 660 } else if ( $target.hasClass( 'edit-post-link' ) && window.opener ) { 684 661 window.opener.focus(); 685 662 window.self.close();