@@ -7,16 +7,18 @@ import classNames from 'classnames';
77import {
88 useCallback , useContext , useEffect , useState ,
99} from 'react' ;
10- import { blockTypes } from '../.. /editors/data/constants/app' ;
11- import DraggableList , { SortableItem } from '../.. /generic/DraggableList' ;
10+ import { blockTypes } from '@src /editors/data/constants/app' ;
11+ import DraggableList , { SortableItem } from '@src /generic/DraggableList' ;
1212
13- import ErrorAlert from '../../generic/alert-error' ;
14- import { getItemIcon } from '../../generic/block-type-utils' ;
15- import { COMPONENT_TYPES } from '../../generic/block-type-utils/constants' ;
16- import { IframeProvider } from '../../generic/hooks/context/iFrameContext' ;
17- import { InplaceTextEditor } from '../../generic/inplace-text-editor' ;
18- import Loading from '../../generic/Loading' ;
19- import TagCount from '../../generic/tag-count' ;
13+ import ErrorAlert from '@src/generic/alert-error' ;
14+ import { getItemIcon } from '@src/generic/block-type-utils' ;
15+ import { COMPONENT_TYPES } from '@src/generic/block-type-utils/constants' ;
16+ import { IframeProvider } from '@src/generic/hooks/context/iFrameContext' ;
17+ import { InplaceTextEditor } from '@src/generic/inplace-text-editor' ;
18+ import Loading from '@src/generic/Loading' ;
19+ import TagCount from '@src/generic/tag-count' ;
20+ import { ToastContext } from '@src/generic/toast-context' ;
21+ import { skipIfUnwantedTarget , useRunOnNextRender } from '@src/utils' ;
2022import { useLibraryContext } from '../common/context/LibraryContext' ;
2123import ComponentMenu from '../components' ;
2224import { LibraryBlockMetadata } from '../data/api' ;
@@ -28,9 +30,7 @@ import {
2830import { LibraryBlock } from '../LibraryBlock' ;
2931import messages from './messages' ;
3032import { SidebarActions , SidebarBodyItemId , useSidebarContext } from '../common/context/SidebarContext' ;
31- import { ToastContext } from '../../generic/toast-context' ;
3233import { canEditComponent } from '../components/ComponentEditorModal' ;
33- import { useRunOnNextRender } from '../../utils' ;
3434
3535/** Components that need large min height in preview */
3636const LARGE_COMPONENTS = [
@@ -91,9 +91,7 @@ const BlockHeader = ({ block, readOnly }: ComponentBlockProps) => {
9191 < Stack
9292 direction = "horizontal"
9393 gap = { 2 }
94- className = "font-weight-bold"
95- // Prevent parent card from being clicked.
96- onClick = { ( e ) => e . stopPropagation ( ) }
94+ className = "font-weight-bold stop-event-propagation"
9795 >
9896 < Icon src = { getItemIcon ( block . blockType ) } />
9997 < InplaceTextEditor
@@ -106,8 +104,7 @@ const BlockHeader = ({ block, readOnly }: ComponentBlockProps) => {
106104 < Stack
107105 direction = "horizontal"
108106 gap = { 3 }
109- // Prevent parent card from being clicked.
110- onClick = { ( e ) => e . stopPropagation ( ) }
107+ className = "stop-event-propagation"
111108 >
112109 { ! showOnlyPublished && block . hasUnpublishedChanges && (
113110 < Badge
@@ -185,7 +182,7 @@ const ComponentBlock = ({ block, readOnly, isDragging }: ComponentBlockProps) =>
185182 borderBottom : 'solid 1px #E1DDDB' ,
186183 } }
187184 isClickable = { ! readOnly }
188- onClick = { ( e ) => handleComponentSelection ( e . detail ) }
185+ onClick = { ( e ) => skipIfUnwantedTarget ( e , ( event ) => handleComponentSelection ( event . detail ) ) }
189186 onKeyDown = { ( e ) => {
190187 if ( e . key === 'Enter' ) {
191188 handleComponentSelection ( e . detail ) ;
0 commit comments