diff --git a/packages/block-library/src/audio/test/__snapshots__/index.js.snap b/packages/block-library/src/audio/test/__snapshots__/index.js.snap
index 6ebf5b5e4f09c..09f551226b702 100644
--- a/packages/block-library/src/audio/test/__snapshots__/index.js.snap
+++ b/packages/block-library/src/audio/test/__snapshots__/index.js.snap
@@ -38,38 +38,6 @@ exports[`core/audio block edit matches snapshot 1`] = `
-
-
diff --git a/packages/block-library/src/cover/test/__snapshots__/index.js.snap b/packages/block-library/src/cover/test/__snapshots__/index.js.snap
index 44e8409be5d7b..36fb23ceb5916 100644
--- a/packages/block-library/src/cover/test/__snapshots__/index.js.snap
+++ b/packages/block-library/src/cover/test/__snapshots__/index.js.snap
@@ -37,39 +37,6 @@ exports[`core/cover block edit matches snapshot 1`] = `
+ />
`;
diff --git a/packages/block-library/src/gallery/test/__snapshots__/index.js.snap b/packages/block-library/src/gallery/test/__snapshots__/index.js.snap
index 9fd3dff017b9d..6e88dd4a4f949 100644
--- a/packages/block-library/src/gallery/test/__snapshots__/index.js.snap
+++ b/packages/block-library/src/gallery/test/__snapshots__/index.js.snap
@@ -39,40 +39,6 @@ exports[`core/gallery block edit matches snapshot 1`] = `
-
-
diff --git a/packages/editor/src/components/media-placeholder/index.js b/packages/editor/src/components/media-placeholder/index.js
index 11b80bcc58b0f..33b2792beb65d 100644
--- a/packages/editor/src/components/media-placeholder/index.js
+++ b/packages/editor/src/components/media-placeholder/index.js
@@ -16,7 +16,7 @@ import {
withFilters,
} from '@wordpress/components';
import { __ } from '@wordpress/i18n';
-import { Component } from '@wordpress/element';
+import { Component, Fragment } from '@wordpress/element';
import { compose } from '@wordpress/compose';
import { withSelect } from '@wordpress/data';
@@ -26,7 +26,6 @@ import { withSelect } from '@wordpress/data';
import MediaUpload from '../media-upload';
import MediaUploadCheck from '../media-upload/check';
import URLPopover from '../url-popover';
-import { mediaUpload } from '../../utils/';
const InsertFromURLPopover = ( { src, onChange, onSubmit, onClose } ) => (
@@ -104,7 +103,7 @@ export class MediaPlaceholder extends Component {
}
onFilesUpload( files ) {
- const { onSelect, multiple, onError, allowedTypes } = this.props;
+ const { onSelect, multiple, onError, allowedTypes, mediaUpload } = this.props;
const setMedia = multiple ? onSelect : ( [ media ] ) => onSelect( media );
mediaUpload( {
allowedTypes,
@@ -136,6 +135,7 @@ export class MediaPlaceholder extends Component {
notices,
allowedTypes = [],
hasUploadPermissions,
+ mediaUpload,
} = this.props;
const {
@@ -202,19 +202,23 @@ export class MediaPlaceholder extends Component {
notices={ notices }
>
-
-
- { __( 'Upload' ) }
-
+ { !! mediaUpload && (
+
+
+
+ { __( 'Upload' ) }
+
+
+ ) }
{
const { canUser } = select( 'core' );
+ const { getEditorSettings } = select( 'core/block-editor' );
return {
hasUploadPermissions: defaultTo( canUser( 'create', 'media' ), true ),
+ mediaUpload: getEditorSettings().__experimentalMediaUpload,
};
} );
diff --git a/packages/editor/src/components/provider/index.js b/packages/editor/src/components/provider/index.js
index 62bf481698b0a..fa85e1b1abadd 100644
--- a/packages/editor/src/components/provider/index.js
+++ b/packages/editor/src/components/provider/index.js
@@ -17,6 +17,8 @@ import { BlockEditorProvider } from '@wordpress/block-editor';
* Internal dependencies
*/
import transformStyles from '../../editor-styles';
+import { mediaUpload } from '../../utils';
+
class EditorProvider extends Component {
constructor( props ) {
super( ...arguments );
@@ -57,6 +59,7 @@ class EditorProvider extends Component {
onChange: onMetaChange,
},
__experimentalReusableBlocks: reusableBlocks,
+ __experimentalMediaUpload: mediaUpload,
};
}