Editor: do not send the request for releasing the post lock on unload when post_ID or active_post_lock is missing.
Props dlh, adamsilverstein. Fixes #38271. git-svn-id: https://develop.svn.wordpress.org/trunk@38772 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
08b94111cb
commit
af80e92ee1
|
@ -105,7 +105,7 @@ window.wp = window.wp || {};
|
||||||
* Overwrite the content of the Featured Image postbox
|
* Overwrite the content of the Featured Image postbox
|
||||||
*
|
*
|
||||||
* @param {string} html New HTML to be displayed in the content area of the postbox.
|
* @param {string} html New HTML to be displayed in the content area of the postbox.
|
||||||
*
|
*
|
||||||
* @global
|
* @global
|
||||||
*/
|
*/
|
||||||
WPSetThumbnailHTML = function(html){
|
WPSetThumbnailHTML = function(html){
|
||||||
|
@ -499,21 +499,28 @@ jQuery(document).ready( function($) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var postID = $('#post_ID').val();
|
||||||
|
var postLock = $('#active_post_lock').val();
|
||||||
|
|
||||||
|
if ( ! postID || ! postLock ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var data = {
|
var data = {
|
||||||
action: 'wp-remove-post-lock',
|
action: 'wp-remove-post-lock',
|
||||||
_wpnonce: $('#_wpnonce').val(),
|
_wpnonce: $('#_wpnonce').val(),
|
||||||
post_ID: $('#post_ID').val(),
|
post_ID: postID,
|
||||||
active_post_lock: $('#active_post_lock').val()
|
active_post_lock: postLock
|
||||||
};
|
};
|
||||||
|
|
||||||
if (window.FormData && window.navigator.sendBeacon) {
|
if ( window.FormData && window.navigator.sendBeacon ) {
|
||||||
var formData = new window.FormData();
|
var formData = new window.FormData();
|
||||||
|
|
||||||
$.each(data, function(key, value) {
|
$.each( data, function( key, value ) {
|
||||||
formData.append(key, value);
|
formData.append( key, value );
|
||||||
});
|
});
|
||||||
|
|
||||||
if (window.navigator.sendBeacon(ajaxurl, formData)) {
|
if ( window.navigator.sendBeacon( ajaxurl, formData ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue