How to make the Preview button automatically open new tab?

The Preview button and associated functionality is currently undergoing a fair amount of iteration – I would imagine we will see a keyboard shortcut added, along with other options for modifying it’s UI down the road.

A Big Hack

Interestingly, the old direct-preview button’s component is still rendered, but is hidden on a > 600px media query. We can reveal the button again with a little CSS:

.edit-post-header__settings .editor-post-preview {
    display: block;
}

I wouldn’t rely on this working indefinitely, however.

A Little Hack

For now, the most canonical solution would probably be to register a block editor plugin which renders a new <PostPreviewButton> component as a child of a <PinnedItems> slotfill.

It should be noted that doing this directly undermines the UX design for the <PinnedItems> slotfill and area, which is intended to show buttons for functionality which the user explicitly opts in to. Thus, were this to be distributed in a plugin, it would be a good idea to associate it with a toggleable editor setting.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)