Post locks:

- Show 'Saving revision...' while autosaving after a post has been taken over. Change to 'Your latest changes were saved as a revision.' when autosave completes.
- Make sure a user exists before using $user->display_name.
- Add 'post_lock_text' action for extending the message text.

git-svn-id: https://develop.svn.wordpress.org/trunk@24042 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz
2013-04-22 03:08:51 +00:00
parent db96892205
commit 008336ee9c
5 changed files with 37 additions and 13 deletions
+13 -2
View File
@@ -277,15 +277,26 @@ $(document).on( 'heartbeat-tick.refresh-lock', function( e, data ) {
wrap = $('#notification-dialog-wrap');
if ( wrap.length && ! wrap.is(':visible') ) {
if ( typeof autosave == 'function' )
if ( typeof autosave == 'function' ) {
$(document).on('autosave-disable-buttons.post-lock', function() {
wrap.addClass('saving');
}).on('autosave-enable-buttons.post-lock', function() {
wrap.removeClass('saving').addClass('saved');
window.onbeforeunload = null;
});
// Save the latest changes and disable
autosave();
autosave = function(){};
}
if ( received.lock_error.avatar_src ) {
avatar = $('<img class="avatar avatar-64 photo" width="64" height="64" />').attr( 'src', received.lock_error.avatar_src.replace(/&amp;/g, '&') );
wrap.find('div.post-locked-avatar').empty().append( avatar );
}
wrap.show().find('p.currently-editing').text( received.lock_error.text ).focus();
wrap.show().find('.currently-editing').text( received.lock_error.text );
wrap.find('.wp-tab-first').focus();
}
} else if ( received.new_lock ) {
$('#active_post_lock').val( received.new_lock );