-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Closed
Labels
[Package] Components/packages/components/packages/components[Package] Edit Post/packages/edit-post/packages/edit-post[Package] Edit Site/packages/edit-site/packages/edit-site[Status] In ProgressTracking issues with work in progressTracking issues with work in progress[Type] EnhancementA suggestion for improvement.A suggestion for improvement.
Description
Description
From Slack: https://wordpress.slack.com/archives/C02RQBWTW/p1708099370819139
The "view preview" that pops up in the bottom left when you save should open in a new tab, like the "Preview in new tab" link does. Having it open same-screen makes no sense.
We'll probably need to change the "View site" link in the site editor as well.
However, the Snackbar
component currently doesn't seem to have a target attribute.
This can be achieved by making the following changes, but I feel that this is not a straightforward approach.
diff --git a/packages/editor/src/store/utils/notice-builder.js b/packages/editor/src/store/utils/notice-builder.js
index 58fc9ca0d7..0027560014 100644
--- a/packages/editor/src/store/utils/notice-builder.js
+++ b/packages/editor/src/store/utils/notice-builder.js
@@ -63,6 +63,10 @@ export function getNotificationArgumentsForSaveSuccess( data ) {
actions.push( {
label: isDraft ? __( 'View Preview' ) : postType.labels.view_item,
url: post.link,
+ onClick: ( event ) => {
+ window.open( post.link, '_blank' );
+ event.preventDefault();
+ },
} );
}
return [
Ideally, I think we would need to add a new target option to the Notice Snackbar
component.
Step-by-step reproduction instructions
- Open the post editor.
- Make changes and save.
- Click "View post" that appears at the bottom left.
- The post should open on the same screen.
Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
yogeshbhutkar
Metadata
Metadata
Assignees
Labels
[Package] Components/packages/components/packages/components[Package] Edit Post/packages/edit-post/packages/edit-post[Package] Edit Site/packages/edit-site/packages/edit-site[Status] In ProgressTracking issues with work in progressTracking issues with work in progress[Type] EnhancementA suggestion for improvement.A suggestion for improvement.