Skip to content

Commit

Permalink
Merge pull request #21301 from Yoast/fix-elementor-snippet-editor
Browse files Browse the repository at this point in the history
Use different snippet editor wrappers in Elementor and block editor
  • Loading branch information
igorschoester committed Apr 9, 2024
2 parents 468f66d + d7d1b8e commit d113618
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
/* External dependencies */
import { SearchIcon } from "@heroicons/react/solid";
import { useSelect } from "@wordpress/data";
import { __ } from "@wordpress/i18n";
import { useSvgAria } from "@yoast/ui-library/src";
import styled from "styled-components";

/* Internal dependencies */
import EditorModal from "../../../containers/EditorModal";
import SnippetEditorWrapper from "../../../containers/SnippetEditor";

import BlockEditorSnippetEditor from "../../../containers/SnippetEditor";
import ElementorSnippetEditor from "../../../elementor/containers/SnippetEditor";

const StyledHeroIcon = styled( SearchIcon )`
width: 18px;
Expand All @@ -22,6 +23,7 @@ const StyledHeroIcon = styled( SearchIcon )`
*/
const SearchAppearanceModal = () => {
const svgAriaProps = useSvgAria();
const isElementorEditor = useSelect( select => select( "yoast-seo/editor" ).getIsElementorEditor(), [] );

return (
<EditorModal
Expand All @@ -30,7 +32,8 @@ const SearchAppearanceModal = () => {
shouldCloseOnClickOutside={ false }
SuffixHeroIcon={ <StyledHeroIcon className="yst-text-slate-500" { ...svgAriaProps } /> }
>
<SnippetEditorWrapper showCloseButton={ false } hasPaperStyle={ false } />
{ isElementorEditor === true && <ElementorSnippetEditor showCloseButton={ false } hasPaperStyle={ false } /> }
{ isElementorEditor === false && <BlockEditorSnippetEditor showCloseButton={ false } hasPaperStyle={ false } /> }
</EditorModal>
);
};
Expand Down

0 comments on commit d113618

Please sign in to comment.