#20233 closed defect (bug) (fixed)
Preview opens in the same window when edit panel was previously another Preview window
Reported by: | hd-J | Owned by: | azaozz |
---|---|---|---|
Milestone: | 3.9 | Priority: | normal |
Severity: | normal | Version: | 3.3.1 |
Component: | Editor | Keywords: | easy-fix has-patch |
Focuses: | Cc: |
Description
Steps to reproduce:
- Create a new post, save as draft
- Click "Preview"
- Go to the Preview window, and from there use the Admin bar to go back to the Dashboard and start writing a new post
- Save that new post as draft
- Hit "Preview"
- Expected result: preview opens in a new window
- Result: preview opens in the same window
Is there some way we could get around that? For people working with multiple tabs, it can be really confusing.
Attachments (1)
Change History (12)
#3
follow-up:
↓ 4
@
11 years ago
- Keywords easy-fix added
I think it's probably as simple as changing the target from "wp-preview" to "_blank", if this is indeed a desired change.
#4
in reply to:
↑ 3
@
11 years ago
Replying to helen:
I think it's probably as simple as changing the target from "wp-preview" to "_blank", if this is indeed a desired change.
Adding "_blank" to the target would make a new tab appear for every time "preview" is clicked.
I've added a patch which basically uses the post ID as part of the target name. Thus every post gets its own dedicated preview tab which will get refreshed on subsequent previews.
Also, entering the post editor will clear the tab's frame name. This is so that if a user starts editing post 1 and then begins editing post 2 from post 1's preview page, a new preview page gets opened for post 1 instead of blowing away their editing in progress.
#6
@
11 years ago
In Chrome 28.0.1500.72 m, I was unable to reproduce. Instead, I got the Expected Result (preview opens in a new window).
Looking at this from a different perspective, I'm thinking there should be a different scenario. If I was to repeat the cycle of Save Draft, Preview, Edit Post 5 times, I've have 6 tabs open (5 on edit and 1 on preview) for this post. I'm unsure if it's possible, but I feel the Edit Post link in the Admin Bar should make the original Edit Post tab be in focus.
#7
@
11 years ago
The proposed patch works for me; in the end it's up to the user if this leads to opening lots of tabs.
#8
@
11 years ago
- Cc weston@… added
I wasn't aware of this ticket and addressed the problem in the Customizer Everywhere plugin. It seems I came up with the exact same solution by including the current post ID in the window target name. Here's the relevant part of the plugin: https://github.com/x-team/wp-customizer-everywhere/blob/454c6debcc1ac0f34caeda3f217542b1d1cb3b21/edit-post.js#L29-L77
I also alerted @azaozz in ticket:25272#comment:7 to preserve the change in the preview window target in his work to refactor autosave.
#9
@
11 years ago
- Owner set to azaozz
- Resolution set to fixed
- Status changed from new to closed
In 27079:
#11
@
11 years ago
azaozz - Curious to know… This opens a new tab when the preview button is hit — which is fine.
But then, leave the tab open, and return to the post that is being edited. Edit a bit more, and hit preview again. Nothing seems to happen. It should probably focus the preview window in addition to opening it, auto-close the preview tab when editing resumes, or always open a new preview tab.
Tested and confirmed in 3.5.2 and in trunk. Still reproducible.