Open previews of different posts in different windows/tabs. Prevent confusion when using a former preview window again if the user navigated to edit another post. If the first post is still being edited, clicking Preview there will use the current window to show the preview. Props ippetkov, fixes #20233.

git-svn-id: https://develop.svn.wordpress.org/trunk@27079 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2014-02-02 23:49:05 +00:00
parent 90662a17f4
commit 33b079b036
2 changed files with 5 additions and 1 deletions

View File

@ -53,7 +53,7 @@ if ( 'publish' == $post->post_status ) {
$preview_button = __( 'Preview' );
}
?>
<a class="preview button" href="<?php echo $preview_link; ?>" target="wp-preview" id="post-preview"><?php echo $preview_button; ?></a>
<a class="preview button" href="<?php echo $preview_link; ?>" target="wp-preview-<?php echo (int) $post->ID; ?>" id="post-preview"><?php echo $preview_button; ?></a>
<input type="hidden" name="wp-preview" id="wp-preview" value="" />
</div>
<?php endif; // public post type ?>

View File

@ -384,6 +384,10 @@ jQuery(document).ready( function($) {
postboxes.add_postbox_toggles(pagenow);
// Clear the window name. Otherwise if this is a former preview window where the user navigated to edit another post,
// and the first post is still being edited, clicking Preview there will use this window to show the preview.
window.name = '';
// Post locks: contain focus inside the dialog. If the dialog is shown, focus the first item.
$('#post-lock-dialog .notification-dialog').on( 'keydown', function(e) {
if ( e.which != 9 )