From 33b079b036d4f7f533e380851f2a896be113ce68 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Sun, 2 Feb 2014 23:49:05 +0000 Subject: [PATCH] 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 --- src/wp-admin/includes/meta-boxes.php | 2 +- src/wp-admin/js/post.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/wp-admin/includes/meta-boxes.php b/src/wp-admin/includes/meta-boxes.php index 887026489b..dcff1ecf43 100644 --- a/src/wp-admin/includes/meta-boxes.php +++ b/src/wp-admin/includes/meta-boxes.php @@ -53,7 +53,7 @@ if ( 'publish' == $post->post_status ) { $preview_button = __( 'Preview' ); } ?> - + diff --git a/src/wp-admin/js/post.js b/src/wp-admin/js/post.js index 0b621464e5..03211b7a39 100644 --- a/src/wp-admin/js/post.js +++ b/src/wp-admin/js/post.js @@ -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 )