diff --git a/includes/blocks/mailchimp/edit.js b/includes/blocks/mailchimp/edit.js index b8f9ac8..b83b450 100644 --- a/includes/blocks/mailchimp/edit.js +++ b/includes/blocks/mailchimp/edit.js @@ -2,14 +2,33 @@ import { useBlockProps } from '@wordpress/block-editor'; import { __ } from '@wordpress/i18n'; import { Placeholder, Button, Disabled } from '@wordpress/components'; import ServerSideRender from '@wordpress/server-side-render'; +import { useSelect } from '@wordpress/data'; import Icon from './icon'; +const disallowedThemesSSR = [ + 'twentytwentyone', + 'twentytwenty', + 'twentynineteen', + 'twentyeighteen', + 'twentyseventeen', + 'twentysixteen', + 'twentyfifteen', + 'twentyfourteen', +]; + export const BlockEdit = ({ isSelected }) => { const blockProps = useBlockProps(); + const isDisallowedThemeSSR = useSelect((select) => { + const currentTheme = select('core').getCurrentTheme(); + if (!currentTheme || (!'template') in currentTheme) { + return false; + } + return disallowedThemesSSR.includes(currentTheme.template); + }); return (