Skip to content

Commit

Permalink
Fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
glendaviesnz committed Feb 2, 2024
1 parent 9dd6396 commit c95e2d0
Showing 1 changed file with 25 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,15 @@ import { store as editorStore } from '../../store';
* editor iframe canvas.
*/
export default function EditTemplateBlocksNotification( { contentRef } ) {
const editTemplate = useSelect( ( select ) => {
const { onNavigateToEntityRecord, templateId } = useSelect( ( select ) => {
const { getEditorSettings, getCurrentTemplateId } =
select( editorStore );
const { getPostLinkProps } = getEditorSettings();
return getPostLinkProps
? getPostLinkProps( {
postId: getCurrentTemplateId(),
postType: 'wp_template',
} )
: {};

return {
onNavigateToEntityRecord:
getEditorSettings().onNavigateToEntityRecord,
templateId: getCurrentTemplateId(),
};
}, [] );

const { getNotices } = useSelect( noticesStore );
Expand Down Expand Up @@ -68,7 +67,11 @@ export default function EditTemplateBlocksNotification( { contentRef } ) {
actions: [
{
label: __( 'Edit template' ),
onClick: () => editTemplate(),
onClick: () =>
onNavigateToEntityRecord( {
postId: templateId,
postType: 'wp_template',
} ),
},
],
}
Expand All @@ -93,15 +96,26 @@ export default function EditTemplateBlocksNotification( { contentRef } ) {
canvas?.removeEventListener( 'click', handleClick );
canvas?.removeEventListener( 'dblclick', handleDblClick );
};
}, [ lastNoticeId, contentRef.current ] );
}, [
lastNoticeId,
contentRef,
getNotices,
createInfoNotice,
onNavigateToEntityRecord,
templateId,
removeNotice,
] );

return (
<ConfirmDialog
isOpen={ isDialogOpen }
confirmButtonText={ __( 'Edit template' ) }
onConfirm={ () => {
setIsDialogOpen( false );
editTemplate();
onNavigateToEntityRecord( {
postId: templateId,
postType: 'wp_template',
} );
} }
onCancel={ () => setIsDialogOpen( false ) }
>
Expand Down

0 comments on commit c95e2d0

Please sign in to comment.