File tree Expand file tree Collapse file tree 1 file changed +20
-9
lines changed Expand file tree Collapse file tree 1 file changed +20
-9
lines changed Original file line number Diff line number Diff line change 8
8
__experimentalVStack as VStack ,
9
9
} from '@wordpress/components' ;
10
10
import { store as blockEditorStore } from '@wordpress/block-editor' ;
11
+ import { isUnmodifiedDefaultBlock } from '@wordpress/blocks' ;
11
12
12
13
/**
13
14
* Internal dependencies
@@ -29,16 +30,26 @@ export function AddComment( {
29
30
showCommentBoard,
30
31
setShowCommentBoard,
31
32
} ) {
32
- const { clientId, blockCommentId } = useSelect ( ( select ) => {
33
- const { getSelectedBlock } = select ( blockEditorStore ) ;
34
- const selectedBlock = getSelectedBlock ( ) ;
35
- return {
36
- clientId : selectedBlock ?. clientId ,
37
- blockCommentId : selectedBlock ?. attributes ?. blockCommentId ,
38
- } ;
39
- } ) ;
33
+ const { clientId, blockCommentId, isEmptyDefaultBlock } = useSelect (
34
+ ( select ) => {
35
+ const { getSelectedBlock } = select ( blockEditorStore ) ;
36
+ const selectedBlock = getSelectedBlock ( ) ;
37
+ return {
38
+ clientId : selectedBlock ?. clientId ,
39
+ blockCommentId : selectedBlock ?. attributes ?. blockCommentId ,
40
+ isEmptyDefaultBlock : selectedBlock
41
+ ? isUnmodifiedDefaultBlock ( selectedBlock )
42
+ : false ,
43
+ } ;
44
+ }
45
+ ) ;
40
46
41
- if ( ! showCommentBoard || ! clientId || undefined !== blockCommentId ) {
47
+ if (
48
+ ! showCommentBoard ||
49
+ ! clientId ||
50
+ undefined !== blockCommentId ||
51
+ isEmptyDefaultBlock
52
+ ) {
42
53
return null ;
43
54
}
44
55
You can’t perform that action at this time.
0 commit comments