-
Notifications
You must be signed in to change notification settings - Fork 882
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
Elementor: partially support document switching #21514
Merged
thijsoo
merged 26 commits into
trunk
from
1694-231-elementor-323-beta6-yoast-tab-is-not-displayed-after-user-navigated-to-site-settings
Aug 6, 2024
Merged
Elementor: partially support document switching #21514
thijsoo
merged 26 commits into
trunk
from
1694-231-elementor-323-beta6-yoast-tab-is-not-displayed-after-user-navigated-to-site-settings
Aug 6, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cf6a3b2
to
2d63599
Compare
In an effort to have a better overview in the elementor-editor-integration
In an effort to have a better overview in the elementor-editor-integration
Saves some searching around for Elementor specific JS code
For `get_document_config` actions. This allows for the registration of the Yoast tab and control to take place. Part of compatibility with the Elementor editor V2.
2d63599
to
880f8cd
Compare
Preparation for separate integration for the control registration. Both should be able to check if our "metabox" is enabled for the current post, this class serves the purpose of retrieving the post.
In favor of moving it to the JS side to test if we should show it or not
Return the callback like Elementor does -- not currently using
This is how Elementor calls it internally
Only run when the document is our form document
* fixes the interval running in favor of a MutationObserver * includes start/stop functionality * includes snapshot functionality
Not so much detecting change, but rather tests is they are deemed relevant. I.e. no scores or calculated changes.
Refactor to Elementor hook to: * not stop listening when switching document * to not run when not on our form document / no post status (conditionals)
This is in favor of the PHP registration to be able to check the document ID is our form ID. Move the link in the more menu to here too, simpler as it needs the tab constant too.
880f8cd
to
d06f227
Compare
Use the code from the previous commits, refactoring amongst others, the form watcher and the Yoast tab. Add events to freeze our form/state and take a snapshot when switching to another document. Add support to restore snapshots when the user discards the Elementor edits.
Elementor sets the color depending on whether the tab is active or not. We're now using same color as whatever Elementor sets. Notes: * the text comment seems to no longer apply * the icon seems to always be a span now
* it would not render when the element was already on the page * added tests
* add actions to notify our other plugins * add redux utils to the external window object
032813c
to
60622fa
Compare
thijsoo
requested changes
Aug 6, 2024
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.
CR 🚧 Some question mostly
thijsoo
approved these changes
Aug 6, 2024
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.
CR + ACC 👍
22 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
changelog: bugfix
Needs to be included in the 'Bugfixes' category in the changelog
UI change
PRs that result in a change in the UI
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
In Elementor the main document is switched when: going to the site settings or using the recent posts in the top bar feature (beta). Our integration can not handle this.
With these changes it will at least be compatible with the initial document. Meaning the user can open the site settings, without losing our integration.
However, when using the recent posts feature to switch to another post, we hide our sidebar on purpose. As we can not deal with fetching the data for the other post on-the-fly yet.
When switching to another post and then discarding the changes, we will now also discard our form and redux state.
Summary
This PR can be summarized in the following changelog entry:
Relevant technical choices:
The original problem is that Elementor switches documents (e.g. post/page/entity) on the fly. Opening their Site Settings will switch the current document, then switch back on closing. They request these documents via AJAX, and along the data here is the tabs and controls for that specific document. This would then override our initial document tab and control registration. And we would not register again due to the PHP side not loading in on the specific AJAX request.
Yoast\WP\SEO\Elementor\Infrastructure\Request_Post
elementor
folder so that it is easier to find. Since we need to test the integration anyway, this seemed like a good moment to sneak that in here.Test instructions
Test instructions for the acceptance test before the PR gets merged
This PR can be acceptance tested by following these steps:
Test original bug: Site Settings
Switching post/page
Test the discard
Test save changes
Regression
Good to know: whatever is the post/page you load the editor in, should be the one you can still edit.
Good to check: are all form fields saved properly?
Relevant test scenarios
Test instructions for QA when the code is in the RC
QA can test this PR by following these steps:
Impact check
This PR affects the following parts of the plugin, which may require extra testing:
UI changes
Other environments
[shopify-seo]
, added test instructions for Shopify and attached theShopify
label to this PR.Documentation
Quality assurance
Innovation
innovation
label.Fixes https://github.com/Yoast/plugins-automated-testing/issues/1694