-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: log wp admin users into front-end preview mode #173
Conversation
ccorda
commented
Oct 14, 2021
•
edited
Loading
edited
- hidden iframe automatically logs user in to preview mode when they login to WP
- cleanup dashboard and add a widget links to enter/exit preview mode
- changing the display of the primary permalink to go direct to frontend
- WP => frontend redirects multi-site compatible
- Preview Mode Bar is now bottom positioned by default
- Preview Mode Bar edit links is now populated with working link
dashboard links to exit.
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/patronage/bubs-next/CazieWsCDqSBK51JavWHEpNmHEcC |
@kylehotchkiss just testing these out on a couple projects, but could you code review as well? |
… before requesting
@@ -35,5 +36,7 @@ function preview_mode_widget() { | |||
|
|||
// Add preview mode iframe | |||
add_action( 'in_admin_footer', function() { | |||
echo "<iframe src=\"" . build_preview_link() . "\" style=\"width:1px:height:1px;opacity:0;\"></iframe>"; | |||
if (function_exists('build_preview_link')) { | |||
echo "<iframe src=\"" . build_preview_link() . "\" style=\"width:1px:height:1px;opacity:0;\"></iframe>"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Random bug i've noticed in sites we've deployed this on - the iframe element causes the footer to cover the bottom row of some tables in the admin dashboard. It's my understanding that an iframe cannot be display:none
as this could prevent it from being loaded, so i wonder if we need to add some absolute off screen positioning
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issues is this width:1px:height:1px
-- i thought it was fixed but looks like it came back. No ;
between width and height.
{postId && ( | ||
<> | ||
| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be a <span style={{ display: 'inline-block', paddingLeft: '5px' }}>
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we're not using inline styles anywhere else, I could add it to SCSS i suppose
Location = `/${slug}`; | ||
} else if (path) { | ||
Location = `/${path}`; | ||
} else if (preview_id || slug || path) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏼
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it was your code ;)
* main: feat: log wp admin users into front-end preview mode (#173)
* main: simpler eslint config (no custom babel) (#185) chore: node minor dep upgrades (#188) docs: env variable with graphcdn fix bug in postheader loading wrong scss file fix env.sample domain for graphcdn fix: meta not respecting social variables, customized title (#176) feat: log wp admin users into front-end preview mode (#173) fix: Get stylelint working again (#182) feat: Next 12 upgrade (#180) feat: bumping husky to version 7 (#179) resolve bug where clicking 'view' in wp-admin leads to a broken redirect (#165) feat: new convenience plugins in wordpress admin (#166) feat: theme mod instead of acf options for preview mode url (#163)