Post locks: when a dialog is shown move focus to the text, see #23697
git-svn-id: http://core.svn.wordpress.org/trunk@23733 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
566e3764c3
commit
10f565cd6c
|
@ -1230,7 +1230,7 @@ function _admin_notice_post_locked() {
|
|||
?>
|
||||
<div class="post-locked-message">
|
||||
<div class="post-locked-avatar"><?php echo get_avatar( $user->ID, 64 ); ?></div>
|
||||
<p><?php esc_html_e( sprintf( __( 'This content is currently locked. If you take over, %s will be blocked from continuing to edit.' ), $user->display_name ) ); ?></p>
|
||||
<p class="currently-editing" tabindex="0"><?php esc_html_e( sprintf( __( 'This content is currently locked. If you take over, %s will be blocked from continuing to edit.' ), $user->display_name ) ); ?></p>
|
||||
<p>
|
||||
<a class="button" href="<?php echo esc_url( wp_get_referer() ); ?>"><?php _e('Go back'); ?></a>
|
||||
<a class="button" href="<?php echo esc_url( $preview_link ); ?>"><?php _e('Preview'); ?></a>
|
||||
|
@ -1251,7 +1251,7 @@ function _admin_notice_post_locked() {
|
|||
?>
|
||||
<div class="post-taken-over">
|
||||
<div class="post-locked-avatar"></div>
|
||||
<p class="currently-editing"></p>
|
||||
<p class="currently-editing" tabindex="0"></p>
|
||||
<p><a class="button button-primary" href="<?php echo esc_url( admin_url('edit.php') ); ?>"><?php _e('Go to All Posts'); ?></a></p>
|
||||
</div>
|
||||
<?php
|
||||
|
|
|
@ -265,6 +265,7 @@ $(document).on( 'heartbeat-send.refresh-lock', function( e, data ) {
|
|||
data['wp-refresh-post-lock'] = send;
|
||||
});
|
||||
|
||||
// Post locks: update the lock string or show the dialog if somebody has taken over editing
|
||||
$(document).on( 'heartbeat-tick.refresh-lock', function( e, data ) {
|
||||
var received, wrap, avatar;
|
||||
|
||||
|
@ -277,19 +278,17 @@ $(document).on( 'heartbeat-tick.refresh-lock', function( e, data ) {
|
|||
|
||||
if ( ! wrap.is(':visible') ) {
|
||||
autosave();
|
||||
wrap.find('p.currently-editing').text( received.lock_error.text );
|
||||
|
||||
|
||||
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(/&/g, '&') );
|
||||
wrap.find('div.post-locked-avatar').empty().append( avatar );
|
||||
}
|
||||
|
||||
wrap.show();
|
||||
wrap.show().find('p.currently-editing').text( received.lock_error.text ).focus();
|
||||
}
|
||||
} else if ( received.new_lock ) {
|
||||
$('#active_post_lock').val( received.new_lock );
|
||||
}
|
||||
|
||||
if ( received['new_lock'] )
|
||||
$('#active_post_lock').val( received['new_lock'].replace(/[^0-9:]+/, '') );
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -300,6 +299,9 @@ jQuery(document).ready( function($) {
|
|||
|
||||
postboxes.add_postbox_toggles(pagenow);
|
||||
|
||||
// Post locks: if the Post Locked dialog is shown, focus it.
|
||||
$('#notification-dialog:visible').find('p.currently-editing').focus();
|
||||
|
||||
// multi-taxonomies
|
||||
if ( $('#tagsdiv-post_tag').length ) {
|
||||
tagBox.init();
|
||||
|
|
Loading…
Reference in New Issue