diff --git a/packages/block-library/src/image/edit.native.js b/packages/block-library/src/image/edit.native.js index c60a40ca3533e..84a6e49b0cf42 100644 --- a/packages/block-library/src/image/edit.native.js +++ b/packages/block-library/src/image/edit.native.js @@ -34,6 +34,8 @@ import { } from '@wordpress/editor'; import { __ } from '@wordpress/i18n'; import { isURL } from '@wordpress/url'; +import { doAction, hasAction } from '@wordpress/hooks'; + /** * Internal dependencies @@ -87,6 +89,10 @@ class ImageEdit extends React.Component { } componentWillUnmount() { + // this action will only exist if the user pressed the trash button on the block holder + if ( hasAction( 'blocks.onRemoveBlockCheckUpload' ) && this.state.isUploadInProgress ) { + doAction( 'blocks.onRemoveBlockCheckUpload', this.props.attributes.id ) + } this.removeMediaUploadListener(); }