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

Consolidate edit media icons in toolbar #17220

Closed
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
6 changes: 6 additions & 0 deletions packages/block-library/src/cover/edit-media-icon.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/**
* WordPress dependencies
*/
import { Path, Rect, SVG } from '@wordpress/components';

export default <SVG width={ 20 } height={ 20 } viewBox="0 0 20 20"><Rect x={ 11 } y={ 3 } width={ 7 } height={ 5 } rx={ 1 } /><Rect x={ 2 } y={ 12 } width={ 7 } height={ 5 } rx={ 1 } /><Path d="M13,12h1a3,3,0,0,1-3,3v2a5,5,0,0,0,5-5h1L15,9Z" /><Path d="M4,8H3l2,3L7,8H6A3,3,0,0,1,9,5V3A5,5,0,0,0,4,8Z" /></SVG>;
3 changes: 2 additions & 1 deletion packages/block-library/src/cover/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import { __ } from '@wordpress/i18n';
* Internal dependencies
*/
import icon from './icon';
import editMediaIcon from './edit-media-icon';
import {
IMAGE_BACKGROUND_TYPE,
VIDEO_BACKGROUND_TYPE,
Expand Down Expand Up @@ -187,7 +188,7 @@ class CoverEdit extends Component {
<IconButton
className="components-toolbar__control"
label={ __( 'Edit media' ) }
icon="edit"
icon={ editMediaIcon }
onClick={ open }
/>
) }
Expand Down
6 changes: 6 additions & 0 deletions packages/block-library/src/media-text/edit-media-icon.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/**
* WordPress dependencies
*/
import { Path, Rect, SVG } from '@wordpress/components';

export default <SVG width={ 20 } height={ 20 } viewBox="0 0 20 20"><Rect x={ 11 } y={ 3 } width={ 7 } height={ 5 } rx={ 1 } /><Rect x={ 2 } y={ 12 } width={ 7 } height={ 5 } rx={ 1 } /><Path d="M13,12h1a3,3,0,0,1-3,3v2a5,5,0,0,0,5-5h1L15,9Z" /><Path d="M4,8H3l2,3L7,8H6A3,3,0,0,1,9,5V3A5,5,0,0,0,4,8Z" /></SVG>;
3 changes: 2 additions & 1 deletion packages/block-library/src/media-text/media-container.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { __ } from '@wordpress/i18n';
* Internal dependencies
*/
import icon from './media-container-icon';
import editMediaIcon from './edit-media-icon';

/**
* Constants
Expand Down Expand Up @@ -55,7 +56,7 @@ class MediaContainer extends Component {
<IconButton
className="components-toolbar__control"
label={ __( 'Edit media' ) }
icon="edit"
icon={ editMediaIcon }
onClick={ open }
/>
) }
Expand Down
6 changes: 6 additions & 0 deletions packages/block-library/src/video/edit-media-icon.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/**
* WordPress dependencies
*/
import { Path, Rect, SVG } from '@wordpress/components';

export default <SVG width={ 20 } height={ 20 } viewBox="0 0 20 20"><Rect x={ 11 } y={ 3 } width={ 7 } height={ 5 } rx={ 1 } /><Rect x={ 2 } y={ 12 } width={ 7 } height={ 5 } rx={ 1 } /><Path d="M13,12h1a3,3,0,0,1-3,3v2a5,5,0,0,0,5-5h1L15,9Z" /><Path d="M4,8H3l2,3L7,8H6A3,3,0,0,1,9,5V3A5,5,0,0,0,4,8Z" /></SVG>;
3 changes: 2 additions & 1 deletion packages/block-library/src/video/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import {
*/
import { createUpgradedEmbedBlock } from '../embed/util';
import icon from './icon';
import editMediaIcon from './edit-media-icon';

const ALLOWED_MEDIA_TYPES = [ 'video' ];
const VIDEO_POSTER_ALLOWED_MEDIA_TYPES = [ 'image' ];
Expand Down Expand Up @@ -206,7 +207,7 @@ class VideoEdit extends Component {
className="components-icon-button components-toolbar__control"
label={ __( 'Edit video' ) }
onClick={ switchToEditing }
icon="edit"
icon={ editMediaIcon }
/>
</Toolbar>
</BlockControls>
Expand Down