diff --git a/src/wp-admin/css/press-this.css b/src/wp-admin/css/press-this.css index 42a76c7d49..00bdad1762 100644 --- a/src/wp-admin/css/press-this.css +++ b/src/wp-admin/css/press-this.css @@ -1363,6 +1363,33 @@ html { margin: 0 auto; } +.spinner { + height: 20px; + width: 20px; + display: inline-block; + visibility: hidden; + background: url(../images/spinner.gif) no-repeat center; + -webkit-background-size: 20px 20px; + background-size: 20px 20px; + opacity: 0.7; + filter: alpha(opacity=70); + line-height: 30px; + vertical-align: baseline; +} + +@media print, + (-webkit-min-device-pixel-ratio: 1.25), + (min-resolution: 120dpi) { + + .spinner { + background-image: url(../images/spinner-2x.gif); + } +} + +.spinner.is-visible { + visibility: visible; +} + /* Make the text inside the editor textarea white. Prevents a "flash" on loading the page */ #pressthis { color: #fff; diff --git a/src/wp-admin/includes/class-wp-press-this.php b/src/wp-admin/includes/class-wp-press-this.php index d5edd17a15..11a9371fa6 100644 --- a/src/wp-admin/includes/class-wp-press-this.php +++ b/src/wp-admin/includes/class-wp-press-this.php @@ -148,23 +148,28 @@ class WP_Press_This { } if ( 'publish' === get_post_status( $post_id ) ) { - /** - * Filter the URL to redirect to when Press This saves. - * - * @since 4.2.0 - * - * @param string $url Redirect URL. If `$status` is 'publish', this will be the post permalink. - * Otherwise, the post edit URL will be used. - * @param int $post_id Post ID. - * @param string $status Post status. - */ - $redirect = apply_filters( 'press_this_save_redirect', get_post_permalink( $post_id ), $post_id, $post['post_status'] ); + $redirect = get_post_permalink( $post_id ); } else { - /** This filter is documented in wp-admin/includes/class-wp-press-this.php */ - $redirect = apply_filters( 'press_this_save_redirect', get_edit_post_link( $post_id, 'raw' ), $post_id, $post['post_status'] ); + $redirect = false; } - wp_send_json_success( array( 'redirect' => $redirect ) ); + /** + * Filter the URL to redirect to when Press This saves. + * + * @since 4.2.0 + * + * @param string $url Redirect URL. If `$status` is 'publish', this will be the post permalink. + * Otherwise, the post edit URL will be used. + * @param int $post_id Post ID. + * @param string $status Post status. + */ + $redirect = apply_filters( 'press_this_save_redirect', $redirect, $post_id, $post['post_status'] ); + + if ( $redirect ) { + wp_send_json_success( array( 'redirect' => $redirect ) ); + } else { + wp_send_json_success( array( 'postSaved' => true ) ); + } } } @@ -1339,6 +1344,7 @@ class WP_Press_This {