Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the mediaUpload block editor setting a stable API #18156

Merged
merged 1 commit into from
Oct 29, 2019
Merged
Show file tree
Hide file tree
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
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