mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
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. Built from https://develop.svn.wordpress.org/trunk@32983 git-svn-id: http://core.svn.wordpress.org/trunk@32954 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
9665259675
commit
275fc220ef
@ -1888,6 +1888,15 @@ html {
|
||||
padding: 0 10px;
|
||||
}
|
||||
|
||||
.publish-button .saving-draft,
|
||||
.publish-button.is-saving .publish {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.publish-button.is-saving .saving-draft {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
/* TinyMCE styles */
|
||||
.editor .wp-media-buttons {
|
||||
float: none;
|
||||
|
2
wp-admin/css/press-this-rtl.min.css
vendored
2
wp-admin/css/press-this-rtl.min.css
vendored
File diff suppressed because one or more lines are too long
@ -1888,6 +1888,15 @@ html {
|
||||
padding: 0 10px;
|
||||
}
|
||||
|
||||
.publish-button .saving-draft,
|
||||
.publish-button.is-saving .publish {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.publish-button.is-saving .saving-draft {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
/* TinyMCE styles */
|
||||
.editor .wp-media-buttons {
|
||||
float: none;
|
||||
|
2
wp-admin/css/press-this.min.css
vendored
2
wp-admin/css/press-this.min.css
vendored
File diff suppressed because one or more lines are too long
@ -146,8 +146,13 @@ class WP_Press_This {
|
||||
}
|
||||
}
|
||||
|
||||
$forceRedirect = false;
|
||||
|
||||
if ( 'publish' === get_post_status( $post_id ) ) {
|
||||
$redirect = get_post_permalink( $post_id );
|
||||
} elseif ( isset( $_POST['pt-force-redirect'] ) && $_POST['pt-force-redirect'] === 'true' ) {
|
||||
$forceRedirect = true;
|
||||
$redirect = get_edit_post_link( $post_id, 'js' );
|
||||
} else {
|
||||
$redirect = false;
|
||||
}
|
||||
@ -165,7 +170,7 @@ class WP_Press_This {
|
||||
$redirect = apply_filters( 'press_this_save_redirect', $redirect, $post_id, $post['post_status'] );
|
||||
|
||||
if ( $redirect ) {
|
||||
wp_send_json_success( array( 'redirect' => $redirect ) );
|
||||
wp_send_json_success( array( 'redirect' => $redirect, 'force' => $forceRedirect ) );
|
||||
} else {
|
||||
wp_send_json_success( array( 'postSaved' => true ) );
|
||||
}
|
||||
@ -1329,6 +1334,7 @@ class WP_Press_This {
|
||||
<input type="hidden" name="post_status" id="post_status" value="draft" />
|
||||
<input type="hidden" name="wp-preview" id="wp-preview" value="" />
|
||||
<input type="hidden" name="post_title" id="post_title" value="" />
|
||||
<input type="hidden" name="pt-force-redirect" id="pt-force-redirect" value="" />
|
||||
<?php
|
||||
|
||||
wp_nonce_field( 'update-post_' . $post_ID, '_wpnonce', false );
|
||||
@ -1456,16 +1462,17 @@ class WP_Press_This {
|
||||
<span class="spinner"> </span>
|
||||
<div class="split-button">
|
||||
<div class="split-button-head">
|
||||
<button type="button" class="publish-button split-button-primary"><?php
|
||||
echo ( current_user_can( 'publish_posts' ) ) ? __( 'Publish' ) : __( 'Submit for Review' );
|
||||
?></button><button type="button" class="split-button-toggle" aria-haspopup="true" aria-expanded="false">
|
||||
<button type="button" class="publish-button split-button-primary" aria-live="polite">
|
||||
<span class="publish"><?php echo ( current_user_can( 'publish_posts' ) ) ? __( 'Publish' ) : __( 'Submit for Review' ); ?></span>
|
||||
<span class="saving-draft"><?php _e( 'Saving...' ); ?></span>
|
||||
</button><button type="button" class="split-button-toggle" aria-haspopup="true" aria-expanded="false">
|
||||
<i class="dashicons dashicons-arrow-down-alt2"></i>
|
||||
<span class="screen-reader-text"><?php _e('More actions'); ?></span>
|
||||
</button>
|
||||
</div>
|
||||
<ul class="split-button-body">
|
||||
<li><button type="button" class="button-subtle draft-button split-button-option" aria-live="polite"><?php _e( 'Save Draft' ); ?></button></li>
|
||||
<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>
|
||||
<li><button type="button" class="button-subtle draft-button split-button-option"><?php _e( 'Save Draft' ); ?></button></li>
|
||||
<li><button type="button" class="button-subtle standard-editor-button split-button-option"><?php _e( 'Standard Editor' ); ?></button></li>
|
||||
<li><button type="button" class="button-subtle preview-button split-button-option"><?php _e( 'Preview' ); ?></button></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -182,21 +182,24 @@
|
||||
}).always( function() {
|
||||
hideSpinner();
|
||||
clearNotices();
|
||||
$( '.publish-button' ).removeClass( 'is-saving' );
|
||||
}).done( function( response ) {
|
||||
if ( ! response.success ) {
|
||||
renderError( response.data.errorMessage );
|
||||
} else if ( response.data.redirect ) {
|
||||
if ( window.opener && settings.redirInParent ) {
|
||||
if ( window.opener && ( settings.redirInParent || response.data.force ) ) {
|
||||
try {
|
||||
window.opener.location.href = response.data.redirect;
|
||||
} catch( er ) {}
|
||||
|
||||
window.self.close();
|
||||
window.setTimeout( function() {
|
||||
window.self.close();
|
||||
}, 200 )
|
||||
} catch( er ) {
|
||||
window.location.href = response.data.redirect;
|
||||
}
|
||||
} else {
|
||||
window.location.href = response.data.redirect;
|
||||
}
|
||||
} else if ( response.data.postSaved ) {
|
||||
// consider showing "Saved" message
|
||||
}
|
||||
}).fail( function() {
|
||||
renderError( __( 'serverError' ) );
|
||||
@ -660,8 +663,10 @@
|
||||
|
||||
if ( $button.length ) {
|
||||
if ( $button.hasClass( 'draft-button' ) ) {
|
||||
$( '.publish-button' ).addClass( 'is-saving' );
|
||||
submitPost( 'draft' );
|
||||
} else if ( $button.hasClass( 'publish-button' ) ) {
|
||||
$button.addClass( 'is-saving' );
|
||||
submitPost( 'publish' );
|
||||
} else if ( $button.hasClass( 'preview-button' ) ) {
|
||||
prepareFormData();
|
||||
@ -670,6 +675,10 @@
|
||||
$( '#wp-preview' ).val( 'dopreview' );
|
||||
$( '#pressthis-form' ).attr( 'target', '_blank' ).submit().attr( 'target', '' );
|
||||
$( '#wp-preview' ).val( '' );
|
||||
} else if ( $button.hasClass( 'standard-editor-button' ) ) {
|
||||
$( '.publish-button' ).addClass( 'is-saving' );
|
||||
$( '#pt-force-redirect' ).val( 'true' );
|
||||
submitPost( 'draft' );
|
||||
} else if ( $button.hasClass( 'split-button-toggle' ) ) {
|
||||
if ( $splitButton.hasClass( 'is-open' ) ) {
|
||||
$splitButton.removeClass( 'is-open' );
|
||||
@ -679,9 +688,6 @@
|
||||
$button.attr( 'aria-expanded', 'true' );
|
||||
}
|
||||
}
|
||||
} else if ( $target.hasClass( 'edit-post-link' ) && window.opener ) {
|
||||
window.opener.focus();
|
||||
window.self.close();
|
||||
}
|
||||
});
|
||||
|
||||
|
2
wp-admin/js/press-this.min.js
vendored
2
wp-admin/js/press-this.min.js
vendored
File diff suppressed because one or more lines are too long
@ -4,7 +4,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.3-alpha-32982';
|
||||
$wp_version = '4.3-alpha-32983';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user