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

Mobile Release v1.111.1 #58115

Merged
merged 9 commits into from
Jan 23, 2024
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ export class RichText extends Component {
onCreateUndoLevel() {
const { __unstableOnCreateUndoLevel: onCreateUndoLevel } = this.props;
// If the content is the same, no level needs to be created.
if ( this.lastHistoryValue.toString() === this.value.toString() ) {
if ( this.lastHistoryValue?.toString() === this.value?.toString() ) {
return;
}

Expand Down Expand Up @@ -317,7 +317,7 @@ export class RichText extends Component {
event.nativeEvent.text
);
// On iOS, onChange can be triggered after selection changes, even though there are no content changes.
if ( contentWithoutRootTag === this.value.toString() ) {
if ( contentWithoutRootTag === this.value?.toString() ) {
return;
}
this.lastEventCount = event.nativeEvent.eventCount;
Expand All @@ -333,7 +333,7 @@ export class RichText extends Component {
);

this.debounceCreateUndoLevel();
const refresh = this.value.toString() !== contentWithoutRootTag;
const refresh = this.value?.toString() !== contentWithoutRootTag;
this.value = contentWithoutRootTag;

// We don't want to refresh if our goal is just to create a record.
Expand Down Expand Up @@ -564,7 +564,7 @@ export class RichText extends Component {
// Check if value is up to date with latest state of native AztecView.
if (
event.nativeEvent.text &&
event.nativeEvent.text !== this.props.value.toString()
event.nativeEvent.text !== this.props.value?.toString()
) {
this.onTextUpdate( event );
}
Expand All @@ -589,7 +589,7 @@ export class RichText extends Component {
// this approach is not perfectly reliable.
const isManual =
this.lastAztecEventType !== 'input' &&
this.props.value.toString() === this.value.toString();
this.props.value?.toString() === this.value?.toString();
if ( hasChanged && isManual ) {
const value = this.createRecord();
const activeFormats = getActiveFormats( value );
Expand Down Expand Up @@ -659,7 +659,7 @@ export class RichText extends Component {
event.nativeEvent.text
);
if (
contentWithoutRootTag === this.value.toString() &&
contentWithoutRootTag === this.value?.toString() &&
realStart === this.selectionStart &&
realEnd === this.selectionEnd
) {
Expand Down Expand Up @@ -756,7 +756,7 @@ export class RichText extends Component {
typeof nextProps.value !== 'undefined' &&
typeof this.props.value !== 'undefined' &&
( ! this.comesFromAztec || ! this.firedAfterTextChanged ) &&
nextProps.value.toString() !== this.props.value.toString()
nextProps.value?.toString() !== this.props.value?.toString()
) {
// Gutenberg seems to try to mirror the caret state even on events that only change the content so,
// let's force caret update if state has selection set.
Expand Down Expand Up @@ -824,7 +824,7 @@ export class RichText extends Component {
const { style, tagName } = this.props;
const { currentFontSize } = this.state;

if ( this.props.value.toString() !== this.value.toString() ) {
if ( this.props.value?.toString() !== this.value?.toString() ) {
this.value = this.props.value;
}
const { __unstableIsSelected: prevIsSelected } = prevProps;
Expand Down Expand Up @@ -884,8 +884,8 @@ export class RichText extends Component {
// On android if content is empty we need to send no content or else the placeholder will not show.
if (
! this.isIOS &&
( value.toString() === '' ||
value.toString() === EMPTY_PARAGRAPH_TAGS )
( value?.toString() === '' ||
value?.toString() === EMPTY_PARAGRAPH_TAGS )
) {
return '';
}
Expand Down
7 changes: 5 additions & 2 deletions packages/block-library/src/video/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ class VideoEdit extends Component {
render() {
const { setAttributes, attributes, isSelected, wasBlockJustInserted } =
this.props;
const { id, src } = attributes;
const { id, src, guid } = attributes;
const { videoContainerHeight } = this.state;

const toolbarEditButton = (
Expand All @@ -236,7 +236,10 @@ class VideoEdit extends Component {
></MediaUpload>
);

if ( ! src ) {
// NOTE: `guid` is not part of the block's attribute definition. This case
// handled here is a temporary fix until a we find a better approach.
const isSourcePresent = src || ( guid && id );
if ( ! isSourcePresent ) {
return (
<View style={ { flex: 1 } }>
<MediaPlaceholder
Expand Down
38 changes: 38 additions & 0 deletions packages/block-library/src/video/test/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,42 @@ describe( 'Video block', () => {

expect( screen.getByText( 'Invalid URL.' ) ).toBeVisible();
} );

it( 'should render empty state when source is not present', async () => {
await initializeEditor( {
initialHtml: `
<!-- wp:video -->
<figure class="wp-block-video"></figure>
<!-- /wp:video -->
`,
} );
const addVideoButton = screen.queryByText( 'Add video' );
expect( addVideoButton ).toBeVisible();
} );

it( 'should not render empty state when video source is present', async () => {
await initializeEditor( {
initialHtml: `
<!-- wp:video {"id":1234} -->
<figure class="wp-block-video"><video controls src="https://VIDEO_URL.mp4"></video></figure>
<!-- /wp:video -->
`,
} );
const addVideoButton = screen.queryByText( 'Add video' );
expect( addVideoButton ).toBeNull();
} );

it( `should not render empty state when 'guid' and 'id' attributes are present`, async () => {
await initializeEditor( {
initialHtml: `
<!-- wp:video {"guid":"ABCD1234","id":1234 -->
<figure class="wp-block-video wp-block-embed is-type-video is-provider-videopress"><div class="wp-block-embed__wrapper">
https://videopress.com/<VIDEO_ID>
</div></figure>
<!-- /wp:video -->
`,
} );
const addVideoButton = screen.queryByText( 'Add video' );
expect( addVideoButton ).toBeNull();
} );
} );
2 changes: 1 addition & 1 deletion packages/react-native-aztec/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@wordpress/react-native-aztec",
"version": "1.110.0",
"version": "1.111.1",
"description": "Aztec view for react-native.",
"private": true,
"author": "The WordPress Contributors",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-bridge/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@wordpress/react-native-bridge",
"version": "1.110.0",
"version": "1.111.1",
"description": "Native bridge library used to integrate the block editor into a native App.",
"private": true,
"author": "The WordPress Contributors",
Expand Down
6 changes: 6 additions & 0 deletions packages/react-native-editor/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ For each user feature we should also add a importance categorization label to i
-->

## Unreleased

## 1.111.1
- [**] Video block: Fix logic for displaying empty state based on source presence [#58015]
- [**] Fix crash when RichText values are not defined [#58088]

## 1.111.0
- [**] Image block media uploads display a custom error message when there is no internet connection [#56937]
- [*] Fix missing custom color indicator for custom gradients [#57605]
- [**] Display a notice when a network connection unavailable [#56934]
Expand Down
10 changes: 5 additions & 5 deletions packages/react-native-editor/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ PODS:
- ReactCommon/turbomodule/core (= 0.71.11)
- fmt (6.2.1)
- glog (0.3.5)
- Gutenberg (1.110.0):
- Gutenberg (1.111.1):
- React-Core (= 0.71.11)
- React-CoreModules (= 0.71.11)
- React-RCTImage (= 0.71.11)
Expand Down Expand Up @@ -429,7 +429,7 @@ PODS:
- React-RCTImage
- RNSVG (13.9.0):
- React-Core
- RNTAztecView (1.110.0):
- RNTAztecView (1.111.1):
- React-Core
- WordPress-Aztec-iOS (= 1.19.9)
- SDWebImage (5.11.1):
Expand Down Expand Up @@ -610,14 +610,14 @@ EXTERNAL SOURCES:
:path: "../../../node_modules/react-native/ReactCommon/yoga"

SPEC CHECKSUMS:
boost: 57d2868c099736d80fcd648bf211b4431e51a558
boost: 7dcd2de282d72e344012f7d6564d024930a6a440
BVLinearGradient: fbe308a1d19a8133f69e033abc85d8008644f5e3
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
FBLazyVector: c511d4cd0210f416cb5c289bd5ae6b36d909b048
FBReactNativeSpec: f07662560742d82a5b73cee116c70b0b49bcc220
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b
Gutenberg: 758124df95be2159a16909fcf00e289b9299fa39
Gutenberg: c251b1260cafc0efee13c29c7b4a22e399e17be2
hermes-engine: 34c863b446d0135b85a6536fa5fd89f48196f848
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
libwebp: 60305b2e989864154bd9be3d772730f08fc6a59c
Expand Down Expand Up @@ -662,7 +662,7 @@ SPEC CHECKSUMS:
RNReanimated: d4f363f4987ae0ade3e36ff81c94e68261bf4b8d
RNScreens: 68fd1060f57dd1023880bf4c05d74784b5392789
RNSVG: 53c661b76829783cdaf9b7a57258f3d3b4c28315
RNTAztecView: 75ea6f071cbdd0f0afe83de7b93c0691a2bebd21
RNTAztecView: 7f2d1f97d07c00efd7f24a687fd2d0c5aec44669
SDWebImage: a7f831e1a65eb5e285e3fb046a23fcfbf08e696d
SDWebImageWebPCoder: 908b83b6adda48effe7667cd2b7f78c897e5111d
WordPress-Aztec-iOS: fbebd569c61baa252b3f5058c0a2a9a6ada686bb
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-editor/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@wordpress/react-native-editor",
"version": "1.110.0",
"version": "1.111.1",
"description": "Mobile WordPress gutenberg editor.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
Expand Down