Changeset 32983
- Timestamp:
- 06/28/2015 04:58:56 AM (10 years ago)
- Location:
- trunk/src/wp-admin
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/css/press-this.css
r32934 r32983 1889 1889 } 1890 1890 1891 .publish-button .saving-draft, 1892 .publish-button.is-saving .publish { 1893 display: none; 1894 } 1895 1896 .publish-button.is-saving .saving-draft { 1897 display: inline; 1898 } 1899 1891 1900 /* TinyMCE styles */ 1892 1901 .editor .wp-media-buttons { -
trunk/src/wp-admin/includes/class-wp-press-this.php
r32944 r32983 147 147 } 148 148 149 $forceRedirect = false; 150 149 151 if ( 'publish' === get_post_status( $post_id ) ) { 150 152 $redirect = get_post_permalink( $post_id ); 153 } elseif ( isset( $_POST['pt-force-redirect'] ) && $_POST['pt-force-redirect'] === 'true' ) { 154 $forceRedirect = true; 155 $redirect = get_edit_post_link( $post_id, 'js' ); 151 156 } else { 152 157 $redirect = false; … … 166 171 167 172 if ( $redirect ) { 168 wp_send_json_success( array( 'redirect' => $redirect ) );173 wp_send_json_success( array( 'redirect' => $redirect, 'force' => $forceRedirect ) ); 169 174 } else { 170 175 wp_send_json_success( array( 'postSaved' => true ) ); … … 1330 1335 <input type="hidden" name="wp-preview" id="wp-preview" value="" /> 1331 1336 <input type="hidden" name="post_title" id="post_title" value="" /> 1337 <input type="hidden" name="pt-force-redirect" id="pt-force-redirect" value="" /> 1332 1338 <?php 1333 1339 … … 1457 1463 <div class="split-button"> 1458 1464 <div class="split-button-head"> 1459 <button type="button" class="publish-button split-button-primary"><?php 1460 echo ( current_user_can( 'publish_posts' ) ) ? __( 'Publish' ) : __( 'Submit for Review' ); 1461 ?></button><button type="button" class="split-button-toggle" aria-haspopup="true" aria-expanded="false"> 1465 <button type="button" class="publish-button split-button-primary" aria-live="polite"> 1466 <span class="publish"><?php echo ( current_user_can( 'publish_posts' ) ) ? __( 'Publish' ) : __( 'Submit for Review' ); ?></span> 1467 <span class="saving-draft"><?php _e( 'Saving...' ); ?></span> 1468 </button><button type="button" class="split-button-toggle" aria-haspopup="true" aria-expanded="false"> 1462 1469 <i class="dashicons dashicons-arrow-down-alt2"></i> 1463 1470 <span class="screen-reader-text"><?php _e('More actions'); ?></span> … … 1465 1472 </div> 1466 1473 <ul class="split-button-body"> 1467 <li><button type="button" class="button-subtle draft-button split-button-option" aria-live="polite"><?php _e( 'Save Draft' ); ?></button></li>1468 <li>< 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></li>1474 <li><button type="button" class="button-subtle draft-button split-button-option"><?php _e( 'Save Draft' ); ?></button></li> 1475 <li><button type="button" class="button-subtle standard-editor-button split-button-option"><?php _e( 'Standard Editor' ); ?></button></li> 1469 1476 <li><button type="button" class="button-subtle preview-button split-button-option"><?php _e( 'Preview' ); ?></button></li> 1470 1477 </ul> -
trunk/src/wp-admin/js/press-this.js
r32966 r32983 183 183 hideSpinner(); 184 184 clearNotices(); 185 $( '.publish-button' ).removeClass( 'is-saving' ); 185 186 }).done( function( response ) { 186 187 if ( ! response.success ) { 187 188 renderError( response.data.errorMessage ); 188 189 } else if ( response.data.redirect ) { 189 if ( window.opener && settings.redirInParent) {190 if ( window.opener && ( settings.redirInParent || response.data.force ) ) { 190 191 try { 191 192 window.opener.location.href = response.data.redirect; 192 } catch( er ) {} 193 194 window.self.close(); 193 194 window.setTimeout( function() { 195 window.self.close(); 196 }, 200 ) 197 } catch( er ) { 198 window.location.href = response.data.redirect; 199 } 195 200 } else { 196 201 window.location.href = response.data.redirect; 197 202 } 198 } else if ( response.data.postSaved ) {199 // consider showing "Saved" message200 203 } 201 204 }).fail( function() { … … 661 664 if ( $button.length ) { 662 665 if ( $button.hasClass( 'draft-button' ) ) { 666 $( '.publish-button' ).addClass( 'is-saving' ); 663 667 submitPost( 'draft' ); 664 668 } else if ( $button.hasClass( 'publish-button' ) ) { 669 $button.addClass( 'is-saving' ); 665 670 submitPost( 'publish' ); 666 671 } else if ( $button.hasClass( 'preview-button' ) ) { … … 671 676 $( '#pressthis-form' ).attr( 'target', '_blank' ).submit().attr( 'target', '' ); 672 677 $( '#wp-preview' ).val( '' ); 678 } else if ( $button.hasClass( 'standard-editor-button' ) ) { 679 $( '.publish-button' ).addClass( 'is-saving' ); 680 $( '#pt-force-redirect' ).val( 'true' ); 681 submitPost( 'draft' ); 673 682 } else if ( $button.hasClass( 'split-button-toggle' ) ) { 674 683 if ( $splitButton.hasClass( 'is-open' ) ) { … … 680 689 } 681 690 } 682 } else if ( $target.hasClass( 'edit-post-link' ) && window.opener ) {683 window.opener.focus();684 window.self.close();685 691 } 686 692 });
Note: See TracChangeset
for help on using the changeset viewer.