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

WIP - Add MediaUploadCheck component #9298

Closed
wants to merge 6 commits into from
Closed
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
8 changes: 8 additions & 0 deletions docs/data/data-core.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,14 @@ get back from the oEmbed preview API.

Is the preview for the URL an oEmbed link fallback.

### hasUploadPermissions

Return whether the user has media upload permissions.

*Returns*

Does the user have media upload permissions?

## Actions

### receiveTerms
Expand Down
107 changes: 0 additions & 107 deletions packages/block-library/src/audio/test/__snapshots__/index.js.snap

This file was deleted.

13 changes: 0 additions & 13 deletions packages/block-library/src/audio/test/index.js

This file was deleted.

33 changes: 18 additions & 15 deletions packages/block-library/src/cover-image/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
BlockAlignmentToolbar,
MediaPlaceholder,
MediaUpload,
MediaUploadCheck,
AlignmentToolbar,
RichText,
} from '@wordpress/editor';
Expand Down Expand Up @@ -130,21 +131,23 @@ export const settings = {
setAttributes( { contentAlign: nextAlign } );
} }
/>
<Toolbar>
<MediaUpload
onSelect={ onSelectImage }
type="image"
value={ id }
render={ ( { open } ) => (
<IconButton
className="components-toolbar__control"
label={ __( 'Edit image' ) }
icon="edit"
onClick={ open }
/>
) }
/>
</Toolbar>
<MediaUploadCheck>
<Toolbar>
<MediaUpload
onSelect={ onSelectImage }
type="image"
value={ id }
render={ ( { open } ) => (
<IconButton
className="components-toolbar__control"
label={ __( 'Edit image' ) }
icon="edit"
onClick={ open }
/>
) }
/>
</Toolbar>
</MediaUploadCheck>
</BlockControls>
{ !! url && (
<InspectorControls>
Expand Down

This file was deleted.

13 changes: 0 additions & 13 deletions packages/block-library/src/cover-image/test/index.js

This file was deleted.

33 changes: 18 additions & 15 deletions packages/block-library/src/file/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { withSelect } from '@wordpress/data';
import { Component, Fragment } from '@wordpress/element';
import {
MediaUpload,
MediaUploadCheck,
MediaPlaceholder,
BlockControls,
RichText,
Expand Down Expand Up @@ -171,21 +172,23 @@ class FileEdit extends Component {
} }
/>
<BlockControls>
<Toolbar>
<MediaUpload
onSelect={ this.onSelectFile }
type="*"
value={ id }
render={ ( { open } ) => (
<IconButton
className="components-toolbar__control"
label={ __( 'Edit file' ) }
onClick={ open }
icon="edit"
/>
) }
/>
</Toolbar>
<MediaUploadCheck>
<Toolbar>
<MediaUpload
onSelect={ this.onSelectFile }
type="*"
value={ id }
render={ ( { open } ) => (
<IconButton
className="components-toolbar__control"
label={ __( 'Edit file' ) }
onClick={ open }
icon="edit"
/>
) }
/>
</Toolbar>
</MediaUploadCheck>
</BlockControls>
<div className={ classes }>
<div className={ `${ className }__content-wrapper` }>
Expand Down
Loading