Skip to content
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

Merged
merged 11 commits into from
Nov 26, 2021
Merged

Conversation

ccorda
Copy link
Contributor

@ccorda ccorda commented Oct 14, 2021

  • 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

@vercel
Copy link

vercel bot commented Oct 14, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/patronage/bubs-next/CazieWsCDqSBK51JavWHEpNmHEcC
✅ Preview: https://bubs-next-git-preview-improvements-patronage.vercel.app

@ccorda
Copy link
Contributor Author

ccorda commented Oct 18, 2021

@kylehotchkiss just testing these out on a couple projects, but could you code review as well?

@ccorda ccorda linked an issue Nov 16, 2021 that may be closed by this pull request
@@ -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>";
Copy link
Member

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

Copy link
Contributor Author

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 && (
<>
&nbsp;&nbsp;|&nbsp;&nbsp;
Copy link
Member

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' }}>?

Copy link
Contributor Author

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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏼

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it was your code ;)

@ccorda ccorda merged commit cd143c4 into main Nov 26, 2021
@ccorda ccorda deleted the preview-improvements branch November 26, 2021 21:20
ccorda added a commit that referenced this pull request Nov 26, 2021
* main:
  feat: log wp admin users into front-end preview mode (#173)
ccorda added a commit that referenced this pull request Dec 28, 2021
* 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Preview Mode Feedback
3 participants