Skip to content

Commit

Permalink
Make the mediaUpload block editor setting a stable API (#18156)
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad authored Oct 29, 2019
1 parent e390bf8 commit c3ea270
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ const applyWithSelect = withSelect( ( select ) => {
const { getSettings } = select( 'core/block-editor' );

return {
mediaUpload: getSettings().__experimentalMediaUpload,
mediaUpload: getSettings().mediaUpload,
};
} );

Expand Down
2 changes: 1 addition & 1 deletion packages/block-editor/src/components/media-upload/check.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ export default withSelect( ( select ) => {
const { getSettings } = select( 'core/block-editor' );

return {
hasUploadPermissions: !! getSettings().__experimentalMediaUpload,
hasUploadPermissions: !! getSettings().mediaUpload,
};
} )( MediaUploadCheck );
6 changes: 2 additions & 4 deletions packages/block-library/src/audio/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,8 @@ class AudioEdit extends Component {
export default compose( [
withSelect( ( select ) => {
const { getSettings } = select( 'core/block-editor' );
const { __experimentalMediaUpload } = getSettings();
return {
mediaUpload: __experimentalMediaUpload,
};
const { mediaUpload } = getSettings();
return { mediaUpload };
} ),
withNotices,
] )( AudioEdit );
4 changes: 2 additions & 2 deletions packages/block-library/src/file/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,11 @@ export default compose( [
withSelect( ( select, props ) => {
const { getMedia } = select( 'core' );
const { getSettings } = select( 'core/block-editor' );
const { __experimentalMediaUpload } = getSettings();
const { mediaUpload } = getSettings();
const { id } = props.attributes;
return {
media: id === undefined ? undefined : getMedia( id ),
mediaUpload: __experimentalMediaUpload,
mediaUpload,
};
} ),
withNotices,
Expand Down
9 changes: 2 additions & 7 deletions packages/block-library/src/gallery/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -379,13 +379,8 @@ class GalleryEdit extends Component {
export default compose( [
withSelect( ( select ) => {
const { getSettings } = select( 'core/block-editor' );
const {
__experimentalMediaUpload,
} = getSettings();

return {
mediaUpload: __experimentalMediaUpload,
};
const { mediaUpload } = getSettings();
return { mediaUpload };
} ),
withNotices,
] )( GalleryEdit );
4 changes: 2 additions & 2 deletions packages/block-library/src/image/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,7 @@ export default compose( [
const { getSettings } = select( 'core/block-editor' );
const { attributes: { id }, isSelected } = props;
const {
__experimentalMediaUpload,
mediaUpload,
imageSizes,
isRTL,
maxWidth,
Expand All @@ -941,7 +941,7 @@ export default compose( [
maxWidth,
isRTL,
imageSizes,
mediaUpload: __experimentalMediaUpload,
mediaUpload,
};
} ),
withViewportMatch( { isLargeViewport: 'medium' } ),
Expand Down
6 changes: 2 additions & 4 deletions packages/block-library/src/video/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,10 +319,8 @@ class VideoEdit extends Component {
export default compose( [
withSelect( ( select ) => {
const { getSettings } = select( 'core/block-editor' );
const { __experimentalMediaUpload } = getSettings();
return {
mediaUpload: __experimentalMediaUpload,
};
const { mediaUpload } = getSettings();
return { mediaUpload };
} ),
withNotices,
withInstanceId,
Expand Down
2 changes: 1 addition & 1 deletion packages/edit-widgets/src/components/widget-area/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function getBlockEditorSettings( blockEditorSettings, hasUploadPermissions ) {
};
return {
...blockEditorSettings,
__experimentalMediaUpload: mediaUploadBlockEditor,
mediaUpload: mediaUploadBlockEditor,
};
}

Expand Down
2 changes: 1 addition & 1 deletion packages/editor/src/components/provider/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ class EditorProvider extends Component {
'__experimentalEnableFullSiteEditing',
'showInserterHelpPanel',
] ),
mediaUpload: hasUploadPermissions ? mediaUpload : undefined,
__experimentalReusableBlocks: reusableBlocks,
__experimentalMediaUpload: hasUploadPermissions ? mediaUpload : undefined,
__experimentalFetchLinkSuggestions: fetchLinkSuggestions,
__experimentalCanUserUseUnfilteredHTML: canUserUseUnfilteredHTML,
};
Expand Down

0 comments on commit c3ea270

Please sign in to comment.