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] Native mobile release v1.7.0 #16156

Merged
merged 5 commits into from
Jun 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions packages/block-editor/src/components/rich-text/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ import {
} from '@wordpress/rich-text';
import { decodeEntities } from '@wordpress/html-entities';
import { BACKSPACE } from '@wordpress/keycodes';
import { pasteHandler, children } from '@wordpress/blocks';
import {
children,
isUnmodifiedDefaultBlock,
pasteHandler,
} from '@wordpress/blocks';
import { isURL } from '@wordpress/url';

/**
Expand Down Expand Up @@ -701,8 +705,8 @@ export class RichText extends Component {
}

componentWillUnmount() {
if ( this._editor.isFocused() ) {
// this._editor.blur();
if ( this._editor.isFocused() && this.props.shouldBlurOnUnmount ) {
this._editor.blur();
}
}

Expand Down Expand Up @@ -875,6 +879,7 @@ const RichTextContainer = compose( [
const {
getSelectionStart,
getSelectionEnd,
__unstableGetBlockWithoutInnerBlocks,
} = select( 'core/block-editor' );

const selectionStart = getSelectionStart();
Expand All @@ -887,12 +892,19 @@ const RichTextContainer = compose( [
);
}

// If the block of this RichText is unmodified then it's a candidate for replacing when adding a new block.
// In order to fix https://github.com/wordpress-mobile/gutenberg-mobile/issues/1126, let's blur on unmount in that case.
// This apparently assumes functionality the BlockHlder actually
const block = clientId && __unstableGetBlockWithoutInnerBlocks( clientId );
const shouldBlurOnUnmount = block && isSelected && isUnmodifiedDefaultBlock( block );

return {
formatTypes: getFormatTypes(),
selectionStart: isSelected ? selectionStart.offset : undefined,
selectionEnd: isSelected ? selectionEnd.offset : undefined,
isSelected,
blockIsSelected,
shouldBlurOnUnmount,
};
} ),
withDispatch( ( dispatch, {
Expand Down
10 changes: 10 additions & 0 deletions packages/edit-post/src/index.native.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* External dependencies
*/
import { Platform } from 'react-native';

/**
* WordPress dependencies
*/
Expand All @@ -22,6 +27,11 @@ export function initializeEditor() {
// eslint-disable-next-line no-undef
if ( typeof __DEV__ === 'undefined' || ! __DEV__ ) {
unregisterBlockType( 'core/code' );

// Disable Video block except for iOS for now.
if ( Platform.OS !== 'ios' ) {
unregisterBlockType( 'core/video' );
}
}
}