Editor, Press This: force a page reload when the user publishes a post and then clicks the back button.

Fixes #23691.
Built from https://develop.svn.wordpress.org/trunk@33836


git-svn-id: http://core.svn.wordpress.org/trunk@33804 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2015-08-31 23:08:22 +00:00
parent db0ca19899
commit e3f3f470ea
5 changed files with 26 additions and 4 deletions

View File

@ -929,6 +929,18 @@ jQuery(document).ready( function($) {
event.preventDefault();
}
});
if ( $( '#original_post_status' ).val() === 'auto-draft' && window.history.replaceState ) {
var location;
$( '#publish' ).on( 'click', function() {
location = window.location.href;
location += ( location.indexOf( '?' ) !== -1 ) ? '&' : '?';
location += 'wp-post-new-reload=true';
window.history.replaceState( null, null, location );
});
}
});
( function( $, counter ) {

File diff suppressed because one or more lines are too long

View File

@ -773,7 +773,8 @@
// Publish, Draft and Preview buttons
$( '.post-actions' ).on( 'click.press-this', function( event ) {
var $target = $( event.target ),
var location,
$target = $( event.target ),
$button = $target.closest( 'button' );
if ( $button.length ) {
@ -782,6 +783,15 @@
submitPost( 'draft' );
} else if ( $button.hasClass( 'publish-button' ) ) {
$button.addClass( 'is-saving' );
if ( window.history.replaceState ) {
location = window.location.href;
location += ( location.indexOf( '?' ) !== -1 ) ? '&' : '?';
location += 'wp-press-this-reload=true';
window.history.replaceState( null, null, location );
}
submitPost( 'publish' );
} else if ( $button.hasClass( 'preview-button' ) ) {
prepareFormData();

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.4-alpha-33835';
$wp_version = '4.4-alpha-33836';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.