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

[RNMobile][Embed block] Enable embed preview for a list of providers #34446

Merged
merged 8 commits into from
Sep 2, 2021
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: { providerNameSlug, previewable, responsive, url },
Expand Down Expand Up @@ -242,7 +246,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 @@ -111,19 +111,16 @@ const EmbedPreview = ( {
disabled={ ! isSelected }
>
<View>
{
// eslint-disable-next-line no-undef
__DEV__ && previewable ? (
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The inline preview feature is no longer limited to development mode so after this PR gets merged the feature will be available in production for the specified providers.

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 inline previews (for now only YouTube and Twitter will be available) [#34447]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the PR should be #34446 instead of #34447 now 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh good catch 😅 , I merged the changes but I forgot to update this entry, I'll update it asap.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the changelog in this commit.

## 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