Make WordPress Core

Changeset 33836


Ignore:
Timestamp:
08/31/2015 11:07:36 PM (11 years ago)
Author:
azaozz
Message:

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

Location:
trunk/src/wp-admin/js
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/js/post.js

    r33468 r33836  
    930930                }
    931931        });
     932
     933        if ( $( '#original_post_status' ).val() === 'auto-draft' && window.history.replaceState ) {
     934                var location;
     935
     936                $( '#publish' ).on( 'click', function() {
     937                        location = window.location.href;
     938                        location += ( location.indexOf( '?' ) !== -1 ) ? '&' : '?';
     939                        location += 'wp-post-new-reload=true';
     940
     941                        window.history.replaceState( null, null, location );
     942                });
     943        }
    932944});
    933945
  • trunk/src/wp-admin/js/press-this.js

    r32999 r33836  
    774774                        // Publish, Draft and Preview buttons
    775775                        $( '.post-actions' ).on( 'click.press-this', function( event ) {
    776                                 var $target = $( event.target ),
     776                                var location,
     777                                        $target = $( event.target ),
    777778                                        $button = $target.closest( 'button' );
    778779
     
    783784                                        } else if ( $button.hasClass( 'publish-button' ) ) {
    784785                                                $button.addClass( 'is-saving' );
     786
     787                                                if ( window.history.replaceState ) {
     788                                                        location = window.location.href;
     789                                                        location += ( location.indexOf( '?' ) !== -1 ) ? '&' : '?';
     790                                                        location += 'wp-press-this-reload=true';
     791
     792                                                        window.history.replaceState( null, null, location );
     793                                                }
     794
    785795                                                submitPost( 'publish' );
    786796                                        } else if ( $button.hasClass( 'preview-button' ) ) {
Note: See TracChangeset for help on using the changeset viewer.