-
Notifications
You must be signed in to change notification settings - Fork 135
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
Fix Faust.js WordPress Plugin Preview #1568
Conversation
🦋 Changeset detectedLatest commit: caec0a9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
📦 Next.js Bundle Analysis for @faustwp/getting-started-exampleThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
'_faustwp_preview_link', | ||
array( | ||
'_preview_link' => get_preview_post_link(), | ||
'_wp_version' => get_bloginfo( 'version' ), |
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.
Adding the WordPress version to better handle any breaking changes until WordPress/gutenberg#13998 is resolved.
Signed-off-by: Joe Fusco <[email protected]>
07466d6
to
ffcac01
Compare
Signed-off-by: Joe Fusco <[email protected]>
Signed-off-by: Joe Fusco <[email protected]>
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.
Nice @josephfusco! Pulled this down locally and observed it working as expected in Local.
@josephfusco Looks like there is a merge conflict. Once this is resolved we can get this merged. |
Signed-off-by: Joe Fusco <[email protected]> # Conflicts: # package-lock.json
I'm now experiencing some weird behavior with this, and I think it's related to the When previewing now on an existing post/page, it looks like it redirects to the preview page properly, but it is no longer creating an autosave beforehand, so you are not seeing the most recent preview data. If you wait for it to autosave, then you'll of course see it, but the autosave is no longer being generated once the preview button is clicked in my experience. cc @josephfusco |
switch (version) { | ||
default: | ||
return { | ||
headerLink: document.querySelector('.edit-post-header-preview__grouping-external a'), |
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.
This query selector can only be used once since we replace the node in line 49 thus making it problematic. If we attempt to read this from a deleted node we may find issues.
// Clone & replace the original link in order to clear pre-existing events. | ||
if (headerLink && headerLink.getAttribute('href') !== faustPreviewLink) { | ||
const clonedHeaderLink = headerLink.cloneNode(true); | ||
headerLink.parentNode.replaceChild(clonedHeaderLink, headerLink); |
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.
Tasks
Description
These changes include a proposed fix for #1561.
Testing
MERL-1205-refactor-custom-preview