File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
includes/blocks/mailchimp Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -2,14 +2,33 @@ import { useBlockProps } from '@wordpress/block-editor';
2
2
import { __ } from '@wordpress/i18n' ;
3
3
import { Placeholder , Button , Disabled } from '@wordpress/components' ;
4
4
import ServerSideRender from '@wordpress/server-side-render' ;
5
+ import { useSelect } from '@wordpress/data' ;
5
6
import Icon from './icon' ;
6
7
8
+ const disallowedThemesSSR = [
9
+ 'twentytwentyone' ,
10
+ 'twentytwenty' ,
11
+ 'twentynineteen' ,
12
+ 'twentyeighteen' ,
13
+ 'twentyseventeen' ,
14
+ 'twentysixteen' ,
15
+ 'twentyfifteen' ,
16
+ 'twentyfourteen' ,
17
+ ] ;
18
+
7
19
export const BlockEdit = ( { isSelected } ) => {
8
20
const blockProps = useBlockProps ( ) ;
21
+ const isDisallowedThemeSSR = useSelect ( ( select ) => {
22
+ const currentTheme = select ( 'core' ) . getCurrentTheme ( ) ;
23
+ if ( ! currentTheme || ( ! 'template' ) in currentTheme ) {
24
+ return false ;
25
+ }
26
+ return disallowedThemesSSR . includes ( currentTheme . template ) ;
27
+ } ) ;
9
28
10
29
return (
11
30
< div { ...blockProps } >
12
- { isSelected ? (
31
+ { isSelected || isDisallowedThemeSSR ? (
13
32
< Placeholder
14
33
icon = { Icon }
15
34
label = { __ ( 'Mailchimp Block' , 'mailchimp_i18n' ) }
You can’t perform that action at this time.
0 commit comments