From 5ae8047326755d43d5b857f8863f03094bcc7cec Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Thu, 2 Sep 2021 10:42:47 +0200 Subject: [PATCH] [RNMobile][Embed block] Enable embed preview for a list of providers (#34446) * Enable embed preview by static list of providers * Enable embed inline previews on production * Update react-native-editor- changelog * Update react-native-editor changelog --- .../block-library/src/embed/edit.native.js | 11 ++++++++- .../src/embed/embed-preview.native.js | 23 ++++++++----------- packages/react-native-editor/CHANGELOG.md | 2 +- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/packages/block-library/src/embed/edit.native.js b/packages/block-library/src/embed/edit.native.js index c0a0946a1fa86d..deb4fe67e76032 100644 --- a/packages/block-library/src/embed/edit.native.js +++ b/packages/block-library/src/embed/edit.native.js @@ -32,6 +32,10 @@ import { import { store as coreStore } from '@wordpress/core-data'; import { View } from '@wordpress/primitives'; +// The inline preview feature will be released progressible, for this reason +// the embed will only be considered previewable for the following providers list. +const PREVIEWABLE_PROVIDERS = [ 'youtube', 'twitter' ]; + const EmbedEdit = ( props ) => { const { attributes: { align, providerNameSlug, previewable, responsive, url }, @@ -243,7 +247,12 @@ const EmbedEdit = ( props ) => { label={ title } onFocus={ onFocus } preview={ preview } - previewable={ previewable } + previewable={ + previewable && + PREVIEWABLE_PROVIDERS.includes( + providerNameSlug + ) + } type={ type } url={ url } /> diff --git a/packages/block-library/src/embed/embed-preview.native.js b/packages/block-library/src/embed/embed-preview.native.js index 7bea26775b6341..8670b3c2d22668 100644 --- a/packages/block-library/src/embed/embed-preview.native.js +++ b/packages/block-library/src/embed/embed-preview.native.js @@ -123,19 +123,16 @@ const EmbedPreview = ( { disabled={ ! isSelected } > - { - // eslint-disable-next-line no-undef - __DEV__ && previewable ? ( - embedWrapper - ) : ( - setIsCaptionSelected( false ) } - /> - ) - } + { previewable ? ( + embedWrapper + ) : ( + setIsCaptionSelected( false ) } + /> + ) } ## Unreleased - +- [**] Enable embed preview for a list of providers (for now only YouTube and Twitter) [#34446] ## 1.60.1 - [*] RNmobile: Fix the cancel button on Block Variation Picker / Columns Block. [#34249] - [*] Column block: Fix Android close button alignment. [#34332]