Skip to content

Enable AI optimize in Classic editor#22118

Merged
mykola merged 18 commits intofeature/ai-optimize-classicfrom
4593-ai-optimize-implement-handling-for-tinymce
Apr 16, 2025
Merged

Enable AI optimize in Classic editor#22118
mykola merged 18 commits intofeature/ai-optimize-classicfrom
4593-ai-optimize-implement-handling-for-tinymce

Conversation

@FAMarfuaty
Copy link
Copy Markdown
Contributor

@FAMarfuaty FAMarfuaty commented Mar 20, 2025

Context

Summary

This PR can be summarized in the following changelog entry:

  • Makes the AI Optimize buttons available for the Classic editor.
  • [wordpress-seo other] Excludes gallery, embed and playlist shortcodes from the keyphrase in introduction analysis in Classic editor.
  • [yoastseo] Outputs the introduction's parent node in findKeywordInFirstParagraph.js research.

Relevant technical choices:

  • We've taken the opportunity to do some renaming of files and classes.

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

AI button: Only Free activated

  • Install and activate Yoast SEO
  • Install and activate Classic editor
  • Create a post in Classic editor
  • Confirm that the behaviour of the AI Optimize button in Classic editor matches the expectation as specified in this doc.

AI button: Free + Premium activated

Excluding gallery, embed, and playlist shortcodes from Keyphrase in introduction assessment

  • Install and activate Yoast SEO
  • Install and activate Classic editor
  • Create a post
  • Follow the testing instruction in Scenario 1.2. of this document and confirm that you get the expected result
    • Before this PR: Gallery, embed, and playlist shortcodes when appearing in the beginning of a post, will be recognized as the introduction
    • After this PR: Gallery, embed, and playlist shortcodes when appearing in the beginning of a post, will not be recognized as the introduction
  • Repeat the testing instruction above for embed and playlist shortcodes
  • Testing only in English is sufficient

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:

  • This PR introduces the functionality to Classic editor, but it's good to smoke test the block editor as well, especially the visibility of the AI Optimize buttons.

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 https://github.com/Yoast/wordpress-seo-premium/issues/4593

Comment thread packages/js/src/components/contentAnalysis/ReadabilityAnalysis.js Outdated
@mhkuu mhkuu added changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog innovation Innovative issue. Relating to performance, memory or data-flow. labels Apr 2, 2025
@mhkuu mhkuu changed the base branch from trunk to feature/ai-optimize-classic April 8, 2025 08:08
@mhkuu
Copy link
Copy Markdown
Contributor

mhkuu commented Apr 8, 2025

Can we revert 674f11c for the moment? That's a product decision which I'm not 100% certain about. I feel like we could make AI Optimize readily available for those types of content but I'll leave the final call to @manuelaugustin 😄

@FAMarfuaty FAMarfuaty marked this pull request as ready for review April 8, 2025 10:21
@FAMarfuaty FAMarfuaty added this to the feature/ai-optimize-classic milestone Apr 8, 2025
/>
}
{ props.renderAIFixesButton( props.hasAIFixes, props.id ) }
{ props.renderAIOptimizeButton( props.hasAIFixes, props.id ) }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

While we are here I'd propose to deconstruct ...props into real variables and use them directly instead of props.:
props.renderAIOptimizeButton -> renderAIOptimizeButton

const getEditorMode = () => {
const editorType = useSelect( ( select ) => select( "yoast-seo/editor" ).getEditorType(), [] );

let editorMode = "";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's use direct return instead of use editorMode variable and set it several times.

@mykola mykola merged commit 4b614ef into feature/ai-optimize-classic Apr 16, 2025
18 checks passed
@mykola mykola deleted the 4593-ai-optimize-implement-handling-for-tinymce branch April 16, 2025 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog innovation Innovative issue. Relating to performance, memory or data-flow.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants