Changeset 32092
- Timestamp:
- 04/08/2015 11:13:35 PM (10 years ago)
- Location:
- trunk/src/wp-admin
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/css/press-this.css
r32051 r32092 342 342 .button-subtle:focus, 343 343 .button-subtle:hover, 344 .button-subtle:active { 344 .button-subtle:active, 345 .edit-post-link:focus, 346 .edit-post-link:hover, 347 .edit-post-link:active { 345 348 color: #00a0d2; 346 349 } 347 350 348 351 .button-subtle:focus, 349 .button-subtle:active { 352 .button-subtle:active, 353 .edit-post-link:focus, 354 .edit-post-link:active { 350 355 outline: 0; 351 356 text-decoration: underline; … … 1374 1379 opacity: 0.7; 1375 1380 filter: alpha(opacity=70); 1376 line-height: 30px;1377 vertical-align: baseline;1381 line-height: 1; 1382 vertical-align: middle; 1378 1383 } 1379 1384 … … 1735 1740 float: right; 1736 1741 margin: 14px 30px 14px 0; 1737 font-size: 0;1742 font-size: 13px; 1738 1743 } 1739 1744 … … 1742 1747 margin: 10px 10px 10px 0; 1743 1748 } 1749 } 1750 1751 .edit-post-link { 1752 font-size: 13px; 1753 display: inline-block; 1754 text-decoration: none; 1755 padding: 0 10px; 1756 } 1757 1758 .draft-button.is-hidden, 1759 .draft-button .saving-draft, 1760 .draft-button.is-saving .save-draft { 1761 display: none; 1762 } 1763 1764 .draft-button.is-saving .saving-draft { 1765 display: inline; 1744 1766 } 1745 1767 -
trunk/src/wp-admin/includes/class-wp-press-this.php
r32014 r32092 1431 1431 <div class="post-actions"> 1432 1432 <span class="spinner"> </span> 1433 <button type="button" class="button-subtle draft-button"><?php _e( 'Save Draft' ); ?></button> 1433 <button type="button" class="button-subtle draft-button" aria-live="polite"> 1434 <span class="save-draft"><?php _e( 'Save Draft' ); ?></span> 1435 <span class="saving-draft"><?php _e( 'Saving...' ); ?></span> 1436 </button> 1437 <a href="<?php echo esc_url( get_edit_post_link( $post_ID ) ); ?>" class="edit-post-link" style="display: none;" target="_blank"><?php _e( 'Edit Post' ); ?></a> 1434 1438 <button type="button" class="button-subtle preview-button"><?php _e( 'Preview' ); ?></button> 1435 1439 <button type="button" class="button-primary publish-button"><?php echo ( current_user_can( 'publish_posts' ) ) ? __( 'Publish' ) : __( 'Submit for Review' ); ?></button> -
trunk/src/wp-admin/js/press-this.js
r31996 r32092 185 185 }).always( function() { 186 186 hideSpinner(); 187 clearNotices(); 187 188 }).done( function( response ) { 189 var $link, $button, keepFocus; 190 188 191 if ( ! response.success ) { 189 192 renderError( response.data.errorMessage ); … … 199 202 } 200 203 } else if ( response.data.postSaved ) { 201 // show "success" message? 204 $link = $( '.edit-post-link' ); 205 $button = $( '.draft-button' ); 206 207 if ( document.activeElement && document.activeElement.className.indexOf( 'draft-button' ) > -1 ) { 208 keepFocus = true; 209 } 210 211 $button.fadeOut( 200, function() { 212 $button.removeClass( 'is-saving' ); 213 $link.fadeIn( 200 ); 214 215 if ( keepFocus ) { 216 $link.focus(); 217 } 218 }); 202 219 } 203 220 }).fail( function() { 204 221 renderError( __( 'serverError' ) ); 222 }); 223 } 224 225 function resetDraftButton() { 226 $( '.edit-post-link' ).fadeOut( 200, function() { 227 $( '.draft-button' ).removeClass( 'is-saving' ).fadeIn( 200 ); 205 228 }); 206 229 } … … 327 350 function renderError( msg ) { 328 351 renderNotice( msg, true ); 352 } 353 354 function clearNotices() { 355 $( 'div.alerts' ).empty(); 329 356 } 330 357 … … 528 555 $titleField.on( 'focus', function() { 529 556 $placeholder.addClass( 'is-hidden' ); 557 resetDraftButton(); 530 558 }).on( 'blur', function() { 531 559 if ( ! $titleField.text() && ! $titleField.html() ) { … … 624 652 * Set app events and other state monitoring related code. 625 653 */ 626 function monitor() {654 function monitor() { 627 655 $( document ).on( 'tinymce-editor-init', function( event, ed ) { 628 656 editor = ed; 629 657 630 ed.on( 'focus', function() {658 function focus() { 631 659 hasSetFocus = true; 632 } ); 660 resetDraftButton(); 661 } 662 663 if ( window.tinymce.Env.iOS ) { 664 editor.on( 'click', focus ); 665 } else { 666 editor.on( 'focus', focus ); 667 } 633 668 }).on( 'click.press-this keypress.press-this', '.suggested-media-thumbnail', function( event ) { 634 669 if ( event.type === 'click' || event.keyCode === 13 ) { … … 638 673 639 674 // Publish, Draft and Preview buttons 640 641 675 $( '.post-actions' ).on( 'click.press-this', function( event ) { 642 var $target = $( event.target ); 643 644 if ( $target.hasClass( 'draft-button' ) ) { 645 submitPost( 'draft' ); 646 } else if ( $target.hasClass( 'publish-button' ) ) { 647 submitPost( 'publish' ); 648 } else if ( $target.hasClass( 'preview-button' ) ) { 649 prepareFormData(); 650 window.opener && window.opener.focus(); 651 652 $( '#wp-preview' ).val( 'dopreview' ); 653 $( '#pressthis-form' ).attr( 'target', '_blank' ).submit().attr( 'target', '' ); 654 $( '#wp-preview' ).val( '' ); 676 var $target = $( event.target ), 677 $button = $target.closest( 'button' ); 678 679 if ( $button.length ) { 680 if ( $button.hasClass( 'draft-button' ) ) { 681 $button.addClass( 'is-saving' ); 682 submitPost( 'draft' ); 683 } else if ( $button.hasClass( 'publish-button' ) ) { 684 submitPost( 'publish' ); 685 } else if ( $button.hasClass( 'preview-button' ) ) { 686 prepareFormData(); 687 window.opener && window.opener.focus(); 688 689 $( '#wp-preview' ).val( 'dopreview' ); 690 $( '#pressthis-form' ).attr( 'target', '_blank' ).submit().attr( 'target', '' ); 691 $( '#wp-preview' ).val( '' ); 692 } 693 } else if ( $target.hasClass( 'edit-post-link' ) && window.opener ) { 694 window.opener.focus(); 695 window.self.close(); 655 696 } 656 697 });
Note: See TracChangeset
for help on using the changeset viewer.