mirror of
git://develop.git.wordpress.org/
synced 2025-02-26 17:42:26 +01:00
When autosaving a new post for the first time after a title was typed, cancel the autosave if the user is submitting the form. (Includes a precommit fix for customize-controls.css.) Props Nessworthy, davidmarichal, fixes #27657
git-svn-id: https://develop.svn.wordpress.org/trunk@27951 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
36f0a60829
commit
30cdc10180
@ -536,6 +536,7 @@ body {
|
||||
position: absolute;
|
||||
top: 0; left: 0; bottom: 0; right: 0;
|
||||
border: 4px solid #2ea2cc;
|
||||
-webkit-border-radius: 2px;
|
||||
border-radius: 2px;
|
||||
}
|
||||
#customize-control-header_image .header-view.button.selected {
|
||||
|
@ -504,13 +504,22 @@ jQuery(document).ready( function($) {
|
||||
// Autosave new posts after a title is typed
|
||||
if ( $( '#auto_draft' ).val() ) {
|
||||
$( '#title' ).blur( function() {
|
||||
var cancel;
|
||||
|
||||
if ( ! this.value || $('#edit-slug-box > *').length ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( wp.autosave ) {
|
||||
wp.autosave.server.triggerSave();
|
||||
}
|
||||
// Cancel the autosave when the blur was triggered by the user submitting the form
|
||||
$('form#post').one( 'submit', function() {
|
||||
cancel = true;
|
||||
});
|
||||
|
||||
window.setTimeout( function() {
|
||||
if ( ! cancel && wp.autosave ) {
|
||||
wp.autosave.server.triggerSave();
|
||||
}
|
||||
}, 200 );
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user