Skip to content

Commit

Permalink
[RNMobile][Embed block] Enable embed preview for a list of providers (#…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
fluiddot authored Sep 2, 2021
1 parent 92662fe commit 5ae8047
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
11 changes: 10 additions & 1 deletion packages/block-library/src/embed/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down Expand Up @@ -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 }
/>
Expand Down
23 changes: 10 additions & 13 deletions packages/block-library/src/embed/embed-preview.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,19 +123,16 @@ const EmbedPreview = ( {
disabled={ ! isSelected }
>
<View>
{
// eslint-disable-next-line no-undef
__DEV__ && previewable ? (
embedWrapper
) : (
<EmbedNoPreview
label={ label }
icon={ icon }
isSelected={ isSelected }
onPress={ () => setIsCaptionSelected( false ) }
/>
)
}
{ previewable ? (
embedWrapper
) : (
<EmbedNoPreview
label={ label }
icon={ icon }
isSelected={ isSelected }
onPress={ () => setIsCaptionSelected( false ) }
/>
) }
<BlockCaption
accessibilityLabelCreator={ accessibilityLabelCreator }
accessible
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-editor/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ For each user feature we should also add a importance categorization label to i
-->

## 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]
Expand Down

0 comments on commit 5ae8047

Please sign in to comment.