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.

Built from https://develop.svn.wordpress.org/trunk@27079


git-svn-id: http://core.svn.wordpress.org/trunk@26952 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2014-02-02 23:50:13 +00:00
parent 7e7723f1de
commit 87c3c8adc0
3 changed files with 6 additions and 2 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 )

File diff suppressed because one or more lines are too long