diff --git wp-admin/edit-form-advanced.php wp-admin/edit-form-advanced.php
index 6df9234..770c851 100644
|
|
|
wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); |
| 329 | 329 | wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); |
| 330 | 330 | ?> |
| 331 | 331 | |
| | 332 | <div id="lost-connection-notice" class="error hidden"> |
| | 333 | <p id="lost-connection-message"> |
| | 334 | <?php _e("You have lost your connection with the server, and saving has been disabled. This message will vanish once you've reconnected."); ?> |
| | 335 | </p> |
| | 336 | </div> |
| | 337 | |
| 332 | 338 | <div id="poststuff"> |
| 333 | 339 | |
| 334 | 340 | <?php |
diff --git wp-includes/js/autosave.js wp-includes/js/autosave.js
index d1914d1..5e1c3f1 100644
|
|
|
function autosave_parse_response(response) { |
| 180 | 180 | function autosave_saved(response) { |
| 181 | 181 | blockSave = false; |
| 182 | 182 | autosave_parse_response(response); // parse the ajax response |
| 183 | | autosave_enable_buttons(); // re-enable disabled form buttons |
| | 183 | |
| | 184 | if ( ! wp.heartbeat.connectionLost ) |
| | 185 | autosave_enable_buttons(); // re-enable disabled form buttons |
| 184 | 186 | } |
| 185 | 187 | |
| 186 | 188 | // called when autosaving new post |
| … |
… |
function autosave_saved_new(response) { |
| 200 | 202 | autosaveDelayPreview = false; |
| 201 | 203 | doPreview(); |
| 202 | 204 | } |
| 203 | | } else { |
| | 205 | } else if ( ! wp.heartbeat.connectionLost ) { |
| 204 | 206 | autosave_enable_buttons(); // re-enable disabled form buttons |
| 205 | 207 | } |
| 206 | 208 | } |
| … |
… |
function autosave_enable_buttons() { |
| 238 | 240 | |
| 239 | 241 | function autosave_disable_buttons() { |
| 240 | 242 | jQuery(':button, :submit', '#submitpost').prop('disabled', true); |
| 241 | | // Re-enable 5 sec later. Just gives autosave a head start to avoid collisions. |
| 242 | | setTimeout(autosave_enable_buttons, 5000); |
| | 243 | |
| | 244 | if ( ! wp.heartbeat.connectionLost ) { |
| | 245 | // Re-enable 5 sec later. Just gives autosave a head start to avoid collisions. |
| | 246 | setTimeout(autosave_enable_buttons, 5000); |
| | 247 | } |
| 243 | 248 | } |
| 244 | 249 | |
| 245 | 250 | function delayed_autosave() { |
| … |
… |
autosave = function() { |
| 256 | 261 | var rich = (typeof tinymce != "undefined") && tinymce.activeEditor && !tinymce.activeEditor.isHidden(), |
| 257 | 262 | post_data, doAutoSave, ed, origStatus, successCallback; |
| 258 | 263 | |
| | 264 | // Disable buttons until we know the save completed. |
| 259 | 265 | autosave_disable_buttons(); |
| 260 | 266 | |
| 261 | 267 | post_data = wp.autosave.getPostData(); |
| … |
… |
wp.autosave.local = { |
| 668 | 674 | wp.autosave.local.init(); |
| 669 | 675 | |
| 670 | 676 | }(jQuery)); |
| | 677 | |
| | 678 | |
| | 679 | // When connection is lost, keep user from submitting changes. |
| | 680 | jQuery(document).on('heartbeat-connection-lost', function() { |
| | 681 | autosave_disable_buttons(); |
| | 682 | jQuery('#lost-connection-notice').show(); |
| | 683 | }); |
| | 684 | |
| | 685 | // When connection returns, make work all the things. |
| | 686 | jQuery(document).on('heartbeat-connection-restored', function() { |
| | 687 | autosave_enable_buttons(); |
| | 688 | jQuery('#lost-connection-notice').hide(); |
| | 689 | }); |
diff --git wp-includes/js/heartbeat.js wp-includes/js/heartbeat.js
index a382599..1060786 100644
|
|
|
window.wp = window.wp || {}; |
| 28 | 28 | |
| 29 | 29 | this.url = typeof ajaxurl != 'undefined' ? ajaxurl : 'wp-admin/admin-ajax.php'; |
| 30 | 30 | this.autostart = true; |
| | 31 | this.connectionLost = false; |
| 31 | 32 | |
| 32 | 33 | if ( typeof( window.heartbeatSettings != 'undefined' ) ) { |
| 33 | 34 | settings = $.extend( {}, window.heartbeatSettings ); |
| … |
… |
window.wp = window.wp || {}; |
| 171 | 172 | |
| 172 | 173 | // temp debug |
| 173 | 174 | if ( self.debug ) |
| 174 | | console.log('### blurred(), slow down...') |
| | 175 | console.log('### blurred(), slow down...'); |
| 175 | 176 | } |
| 176 | 177 | |
| 177 | 178 | function focused() { |
| … |
… |
window.wp = window.wp || {}; |
| 192 | 193 | |
| 193 | 194 | // temp debug |
| 194 | 195 | if ( self.debug ) |
| 195 | | console.log('### focused(), speed up... ') |
| | 196 | console.log('### focused(), speed up... '); |
| 196 | 197 | } |
| 197 | 198 | |
| 198 | 199 | function setFrameEvents() { |