Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions packages/block-library/src/image/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { get, isEmpty, pick } from 'lodash';
* WordPress dependencies
*/
import { getBlobByURL, isBlobURL, revokeBlobURL } from '@wordpress/blob';
import { withNotices, Placeholder } from '@wordpress/components';
import { useSelect } from '@wordpress/data';
import { Placeholder } from '@wordpress/components';
import { useDispatch, useSelect } from '@wordpress/data';
import {
BlockAlignmentControl,
BlockControls,
Expand All @@ -22,6 +22,7 @@ import {
import { useEffect, useRef, useState } from '@wordpress/element';
import { __ } from '@wordpress/i18n';
import { image as icon } from '@wordpress/icons';
import { store as noticesStore } from '@wordpress/notices';

/**
* Internal dependencies
Expand Down Expand Up @@ -108,9 +109,7 @@ export function ImageEdit( {
setAttributes,
isSelected,
className,
noticeUI,
insertBlocksAfter,
noticeOperations,
onReplace,
context,
clientId,
Expand Down Expand Up @@ -143,9 +142,9 @@ export function ImageEdit( {
return pick( getSettings(), [ 'imageDefaultSize', 'mediaUpload' ] );
}, [] );

const { createErrorNotice } = useDispatch( noticesStore );
function onUploadError( message ) {
noticeOperations.removeAllNotices();
noticeOperations.createErrorNotice( message );
createErrorNotice( message, { type: 'snackbar' } );
setAttributes( {
src: undefined,
id: undefined,
Expand Down Expand Up @@ -361,7 +360,6 @@ export function ImageEdit( {
icon={ <BlockIcon icon={ icon } /> }
onSelect={ onSelectImage }
onSelectURL={ onSelectURL }
notices={ noticeUI }
onError={ onUploadError }
placeholder={ placeholder }
accept="image/*"
Expand All @@ -374,4 +372,4 @@ export function ImageEdit( {
);
}

export default withNotices( ImageEdit );
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We no longer need this HoC.

export default ImageEdit;