Skip to content

get editor data image doesn't include image from the content#22106

Merged
igorschoester merged 13 commits intotrunkfrom
21982-elementor-social-media-appearance-props-not-updating-upon-post-content-change
Mar 26, 2025
Merged

get editor data image doesn't include image from the content#22106
igorschoester merged 13 commits intotrunkfrom
21982-elementor-social-media-appearance-props-not-updating-upon-post-content-change

Conversation

@vraja-pro
Copy link
Copy Markdown
Contributor

@vraja-pro vraja-pro commented Mar 14, 2025

Context

  • We want to fix fallback image and replacement variables.

Summary

This PR can be summarized in the following changelog entry:

  • Fixes a bug where the content image would not show on social previews when editing it in Elementor.
  • Fixes a bug where the advanced replacement variables would not be visible when editing social previews in Elementor.

Relevant technical choices:

  • I moved the change in replacement variables one level up to the registration of the store.
  • I removed the containers for Facebook and Twitter because we were not using them and by fixing the replacement variables initial state and the elementor editor watcher I was able to reach the same goal they were serving.
  • The fallback image is now fetched from the fallbacks section of the store and the the editorData, I think that moving to use the editorData is out of scope because the entire social appearance is leaning on data from the snippet editor which includes also some of the editor data.

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

Fallback image

  • Create a post in the Block editor, add an image in its body and don't set any social image in the Social media appearance section
  • Click on Social appearance fromt the yoast side bar and check you see in the preview the image from the post content.
  • Edit the post in Elementor
  • open the Social media appearance modal from the Yoast sidebar
  • Check you see the image from the content as before.
  • Close the modal and change the image in the post content.
  • Open the modal again and check preview image has changed accordingly.
  • Repeat test for twitter preview.

Excerpt

  • Edit a post in Elementor with excerpt (not the block excerpt, add excerpt either in block editor post tab or classic editor excerpt box)
  • Go to Social appearance and add to the description the replacement variable for excerpt.
  • Have Yoast premium enabled to see the preview.
  • Check you see the excerpt in the preview.
  • Edit the except in the Elementor settings tab.
  • Go back to the Social appearance and check in the preview that the excerpt has been updated.
  • Go back to the post edit page before editing with Elementor
  • Remove the excerpt and add content that is bigger than 200 words.
  • Go to the search appearance and add to the description the replacement variables onlyExcerpt separator excerpt
  • Check you see the separator and cropped excerpt from the content.
  • Edit with Elementor and check the search appearance preview is the same as before entering the Elementor editor.
  • Change the content in the Elementor editor and check the search preview and social preview with excerpt replacement variable is changing.

Replacement variables:

Repeat the tests in #16525 and #16455.

Relevant test scenarios

  • Changes should be tested with the browser console open
  • Changes should be tested on different posts/pages/taxonomies/custom post types/custom taxonomies
  • Changes should be tested on different editors (Default Block/Gutenberg/Classic/Elementor/other)
  • Changes should be tested on different browsers
  • Changes should be tested on multisite

Test instructions for QA when the code is in the RC

  • QA should use the same steps as above.

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

  • This PR changes the UI in the plugin. I have added the 'UI change' label to this PR.

Other environments

  • This PR also affects Shopify. I have added a changelog entry starting with [shopify-seo], added test instructions for Shopify and attached the Shopify label to this PR.

Documentation

  • I have written documentation for this change. For example, comments in the Relevant technical choices, comments in the code, documentation on Confluence / shared Google Drive / Yoast developer portal, or other.

Quality assurance

  • I have tested this code to the best of my abilities.
  • During testing, I had activated all plugins that Yoast SEO provides integrations for.
  • I have added unit tests to verify the code works as intended.
  • If any part of the code is behind a feature flag, my test instructions also cover cases where the feature flag is switched off.
  • I have written this PR in accordance with my team's definition of done.
  • I have checked that the base branch is correctly set.

Innovation

  • No innovation project is applicable for this PR.
  • This PR falls under an innovation project. I have attached the innovation label.
  • I have added my hours to the WBSO document.

Fixes Elementor: Social media appearance props not updating upon post content change

@vraja-pro vraja-pro added the changelog: bugfix Needs to be included in the 'Bugfixes' category in the changelog label Mar 14, 2025
@coveralls
Copy link
Copy Markdown

coveralls commented Mar 14, 2025

Pull Request Test Coverage Report for Build 3a5622d23ac9596f18c5ab2dc1442fe9e872f960

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 18 (0.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.008%) to 52.442%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/js/src/elementor/initializers/editor-watcher.js 0 18 0.0%
Totals Coverage Status
Change from base Build 3417f6b7154bbb75ef189660765d07e52c90b3de: 0.008%
Covered Lines: 29799
Relevant Lines: 57964

💛 - Coveralls

@vraja-pro vraja-pro force-pushed the 21982-elementor-social-media-appearance-props-not-updating-upon-post-content-change branch from 33967d6 to 77de5b4 Compare March 15, 2025 19:37
Copy link
Copy Markdown
Contributor

@igorschoester igorschoester left a comment

Choose a reason for hiding this comment

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

CR ❓

Nice workaround you found! 🥳

Comment thread packages/js/src/elementor/containers/SnippetEditor.js
Comment thread packages/js/src/elementor/initializers/editor-watcher.js Outdated
Comment thread packages/js/src/elementor/initializers/editor-watcher.js Outdated
Comment thread packages/js/src/elementor/initializers/editor-watcher.js
Copy link
Copy Markdown
Contributor

@igorschoester igorschoester left a comment

Choose a reason for hiding this comment

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

CR && AT ✅

@igorschoester igorschoester added this to the 24.9 milestone Mar 26, 2025
@igorschoester igorschoester merged commit 2fbff94 into trunk Mar 26, 2025
19 checks passed
@igorschoester igorschoester deleted the 21982-elementor-social-media-appearance-props-not-updating-upon-post-content-change branch March 26, 2025 11:51
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Elementor: Social media appearance props not updating upon post content change

3 participants