Make WordPress Core


Ignore:
Timestamp:
06/28/2015 04:58:56 AM (11 years ago)
Author:
azaozz
Message:

Press This:

  • Save a draft before opening the standard editor window.
  • While saving a post show Saving... instead of Publish for the main visible part of the split button (same as the Save Draft button before).

See #32757.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-press-this.php

    r32944 r32983  
    147147                        }
    148148
     149                        $forceRedirect = false;
     150
    149151                        if ( 'publish' === get_post_status( $post_id ) ) {
    150152                                $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' );
    151156                        } else {
    152157                                $redirect = false;
     
    166171
    167172                        if ( $redirect ) {
    168                                 wp_send_json_success( array( 'redirect' => $redirect ) );
     173                                wp_send_json_success( array( 'redirect' => $redirect, 'force' => $forceRedirect ) );
    169174                        } else {
    170175                                wp_send_json_success( array( 'postSaved' => true ) );
     
    13301335                <input type="hidden" name="wp-preview" id="wp-preview" value="" />
    13311336                <input type="hidden" name="post_title" id="post_title" value="" />
     1337                <input type="hidden" name="pt-force-redirect" id="pt-force-redirect" value="" />
    13321338                <?php
    13331339
     
    14571463                        <div class="split-button">
    14581464                                <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">
    14621469                                                <i class="dashicons dashicons-arrow-down-alt2"></i>
    14631470                                                <span class="screen-reader-text"><?php _e('More actions'); ?></span>
     
    14651472                                </div>
    14661473                                <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>
    14691476                                        <li><button type="button" class="button-subtle preview-button split-button-option"><?php _e( 'Preview' ); ?></button></li>
    14701477                                </ul>
Note: See TracChangeset for help on using the changeset viewer.