Skip to content

Commit

Permalink
Make sure that the AI button is not shown in Elementor
Browse files Browse the repository at this point in the history
  • Loading branch information
FAMarfuaty committed May 14, 2024
1 parent ede70f0 commit 4a41337
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/js/src/components/contentAnalysis/SeoAnalysis.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ class SeoAnalysis extends Component {
];
}


/**
* Renders the AI Assessment Fixes button.
*
Expand All @@ -203,12 +202,12 @@ class SeoAnalysis extends Component {
renderAIFixesButton = ( hasAIFixes, id ) => {
const isPremium = getL10nObject().isPremium;

return hasAIFixes && isBlockEditor() && (
// The reason of adding the check if Elementor is active or not is because `isBlockEditor` method also returns `true` for Elementor.
return hasAIFixes && isBlockEditor() && ! this.props.isElementor && (
<AIAssessmentFixesButton id={ id } isPremium={ isPremium } />
);
};


/**
* Renders the SEO Analysis component.
*
Expand Down Expand Up @@ -290,6 +289,7 @@ SeoAnalysis.propTypes = {
shouldUpsellWordFormRecognition: PropTypes.bool,
overallScore: PropTypes.number,
shouldUpsellHighlighting: PropTypes.bool,
isElementor: PropTypes.bool,
};

SeoAnalysis.defaultProps = {
Expand All @@ -300,13 +300,15 @@ SeoAnalysis.defaultProps = {
shouldUpsellWordFormRecognition: false,
overallScore: null,
shouldUpsellHighlighting: false,
isElementor: false,
};

export default withSelect( ( select, ownProps ) => {
const {
getFocusKeyphrase,
getMarksButtonStatus,
getResultsForKeyword,
getIsElementorEditor,
} = select( "yoast-seo/editor" );

const keyword = getFocusKeyphrase();
Expand All @@ -315,5 +317,6 @@ export default withSelect( ( select, ownProps ) => {
...getResultsForKeyword( keyword ),
marksButtonStatus: ownProps.hideMarksButtons ? "disabled" : getMarksButtonStatus(),
keyword,
isElementor: getIsElementorEditor(),
};
} )( SeoAnalysis );

0 comments on commit 4a41337

Please sign in to comment.