From a0e89faf8af8a08a72a619ad92e99386d6892ee2 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Fri, 29 Sep 2023 18:12:24 +0200 Subject: [PATCH] [RNMobile] Set native extension to media upload constant file (#54928) * Set native extension to media upload constants file * Remove unused constant of media upload options * Use media option constants in `MediaUpload` component --- .../{constants.js => constants.native.js} | 1 - .../src/components/media-upload/index.native.js | 14 +++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) rename packages/block-editor/src/components/media-upload/{constants.js => constants.native.js} (86%) diff --git a/packages/block-editor/src/components/media-upload/constants.js b/packages/block-editor/src/components/media-upload/constants.native.js similarity index 86% rename from packages/block-editor/src/components/media-upload/constants.js rename to packages/block-editor/src/components/media-upload/constants.native.js index 2697be40e562c..4463df2984382 100644 --- a/packages/block-editor/src/components/media-upload/constants.js +++ b/packages/block-editor/src/components/media-upload/constants.native.js @@ -10,6 +10,5 @@ export const MEDIA_TYPE_ANY = 'any'; export const OPTION_TAKE_VIDEO = __( 'Take a Video' ); export const OPTION_TAKE_PHOTO = __( 'Take a Photo' ); -export const OPTION_TAKE_PHOTO_OR_VIDEO = __( 'Take a Photo or Video' ); export const OPTION_INSERT_FROM_URL = __( 'Insert from URL' ); export const OPTION_WORDPRESS_MEDIA_LIBRARY = __( 'WordPress Media Library' ); diff --git a/packages/block-editor/src/components/media-upload/index.native.js b/packages/block-editor/src/components/media-upload/index.native.js index 97fa69d49a4ec..05a36d7a09bca 100644 --- a/packages/block-editor/src/components/media-upload/index.native.js +++ b/packages/block-editor/src/components/media-upload/index.native.js @@ -39,6 +39,10 @@ import { MEDIA_TYPE_VIDEO, MEDIA_TYPE_AUDIO, MEDIA_TYPE_ANY, + OPTION_TAKE_VIDEO, + OPTION_TAKE_PHOTO, + OPTION_INSERT_FROM_URL, + OPTION_WORDPRESS_MEDIA_LIBRARY, } from './constants'; import styles from './style.scss'; @@ -93,7 +97,7 @@ export class MediaUpload extends Component { const cameraImageSource = { id: mediaSources.deviceCamera, // ID is the value sent to native. value: mediaSources.deviceCamera + '-IMAGE', // This is needed to diferenciate image-camera from video-camera sources. - label: __( 'Take a Photo' ), + label: OPTION_TAKE_PHOTO, requiresModal: true, types: [ MEDIA_TYPE_IMAGE ], icon: capturePhoto, @@ -102,7 +106,7 @@ export class MediaUpload extends Component { const cameraVideoSource = { id: mediaSources.deviceCamera, value: mediaSources.deviceCamera, - label: __( 'Take a Video' ), + label: OPTION_TAKE_VIDEO, requiresModal: true, types: [ MEDIA_TYPE_VIDEO ], icon: captureVideo, @@ -120,7 +124,7 @@ export class MediaUpload extends Component { const siteLibrarySource = { id: mediaSources.siteMediaLibrary, value: mediaSources.siteMediaLibrary, - label: __( 'WordPress Media Library' ), + label: OPTION_WORDPRESS_MEDIA_LIBRARY, requiresModal: true, types: [ MEDIA_TYPE_IMAGE, @@ -135,7 +139,7 @@ export class MediaUpload extends Component { const urlSource = { id: URL_MEDIA_SOURCE, value: URL_MEDIA_SOURCE, - label: __( 'Insert from URL' ), + label: OPTION_INSERT_FROM_URL, types: [ MEDIA_TYPE_AUDIO, MEDIA_TYPE_IMAGE, MEDIA_TYPE_VIDEO ], icon: globe, }; @@ -329,7 +333,7 @@ function URLInput( props ) { autoCorrect={ false } autoComplete={ Platform.isIOS ? 'url' : 'off' } keyboardType="url" - label={ __( 'Insert from URL' ) } + label={ OPTION_INSERT_FROM_URL } onChange={ props.onChange } placeholder={ __( 'Type a URL' ) } value={ props.value }