From 041394d72f5bca991e90959e4d2d28b24350184a Mon Sep 17 00:00:00 2001 From: Tugdual de Kerviler Date: Fri, 10 Jan 2020 18:03:15 +0100 Subject: [PATCH 1/2] [RNMobile] Merge mobile release v1.20.0 back into master (#19562) * styling fixes after navigation feature merge (#19455) * Styling fixes to navigation feature * Add netural styles for toolbar * Fix condition for not registered component * Display 'Unsupported' in breadcrumbs for missing components * Refactor after CR * Remove leftovers * [FIX] rich text focus loop (#19240) * check if onBlur event contains text that is different than value * add check if there is a text in native event * Prevent re-selection of RichText when native selection changes as a result of resigning focus * Fix typo * Check if isSelected only in onSelectionChangeFromAztec Co-authored-by: Jorge Bernal * [RNMobile] Correct displaying photo during upload (#19502) * [RNMobile] Fix crash once adding Group (#19457) * Add extra branch for travis to run tests onto Co-authored-by: Luke Walczak Co-authored-by: Drapich Piotr Co-authored-by: Jorge Bernal --- .travis.yml | 2 +- packages/base-styles/_variables.scss | 2 +- .../src/components/block-list/block.native.js | 20 ++++++++++++++++--- .../components/block-list/block.native.scss | 13 ++++++++++-- .../block-list/breadcrumb.native.js | 6 +++++- .../src/media-text/style.native.scss | 1 - packages/block-library/src/missing/index.js | 2 +- .../components/src/button/index.native.js | 4 ++-- .../rich-text/src/component/index.native.js | 17 ++++++++++++++-- 9 files changed, 53 insertions(+), 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index 122858672c93e9..8798f87bb55da5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,7 @@ branches: only: - master - rnmobile/master - - rnmobile/releases + - /rnmobile\/release.*/ - /wp\/.*/ env: diff --git a/packages/base-styles/_variables.scss b/packages/base-styles/_variables.scss index 5c034cf7fb963c..ab3cad778bce93 100644 --- a/packages/base-styles/_variables.scss +++ b/packages/base-styles/_variables.scss @@ -74,7 +74,7 @@ $block-selected-child-border-width: 1px; $block-selected-child-padding: 0; $block-selected-to-content: $block-edge-to-content - $block-selected-margin - $block-selected-border-width; $block-selected-child-to-content: $block-selected-to-content - $block-selected-child-margin - $block-selected-child-border-width; -$block-custom-appender-to-content: $block-edge-to-content - $block-selected-margin - $block-selected-child-margin + $block-selected-border-width; +$block-custom-appender-to-content: $block-selected-margin - $block-selected-border-width; $block-media-container-to-content: $block-selected-child-margin + $block-selected-border-width; // Buttons & UI Widgets diff --git a/packages/block-editor/src/components/block-list/block.native.js b/packages/block-editor/src/components/block-list/block.native.js index e5eec2effa8cce..52207023a13c54 100644 --- a/packages/block-editor/src/components/block-list/block.native.js +++ b/packages/block-editor/src/components/block-list/block.native.js @@ -14,7 +14,7 @@ import { Component } from '@wordpress/element'; import { ToolbarButton, Toolbar } from '@wordpress/components'; import { withDispatch, withSelect } from '@wordpress/data'; import { compose, withPreferredColorScheme } from '@wordpress/compose'; -import { getBlockType } from '@wordpress/blocks'; +import { getBlockType, getUnregisteredTypeHandlerName } from '@wordpress/blocks'; import { __, sprintf } from '@wordpress/i18n'; /** @@ -188,6 +188,17 @@ class BlockListBlock extends Component { ]; } + applyToolbarStyle() { + const { + hasChildren, + isUnregisteredBlock, + } = this.props; + + if ( ! hasChildren || isUnregisteredBlock ) { + return styles.neutralToolbar; + } + } + render() { const { clientId, @@ -228,7 +239,7 @@ class BlockListBlock extends Component { style={ this.applyBlockStyle() } > { isValid ? this.getBlockForType() : } - { isSelected && } + { isSelected && } @@ -261,6 +272,8 @@ export default compose( [ const isLastBlock = order === getBlocks().length - 1; const block = __unstableGetBlockWithoutInnerBlocks( clientId ); const { name, attributes, isValid } = block || {}; + + const isUnregisteredBlock = name === getUnregisteredTypeHandlerName(); const blockType = getBlockType( name || 'core/missing' ); const title = blockType.title; const icon = blockType.icon; @@ -281,7 +294,7 @@ export default compose( [ const commonAncestorIndex = parents.indexOf( commonAncestor ) - 1; const firstToSelectId = commonAncestor ? parents[ commonAncestorIndex ] : parents[ parents.length - 1 ]; - const hasChildren = !! getBlockCount( clientId ); + const hasChildren = ! isUnregisteredBlock && !! getBlockCount( clientId ); const hasParent = !! parentId; const isParentSelected = selectedBlockClientId && selectedBlockClientId === parentId; const isAncestorSelected = selectedBlockClientId && parents.includes( selectedBlockClientId ); @@ -317,6 +330,7 @@ export default compose( [ isTouchable, isDimmed, isRootListInnerBlockHolder, + isUnregisteredBlock, }; } ), withDispatch( ( dispatch, ownProps, { select } ) => { diff --git a/packages/block-editor/src/components/block-list/block.native.scss b/packages/block-editor/src/components/block-list/block.native.scss index ff9cea835a83c9..3867b583105979 100644 --- a/packages/block-editor/src/components/block-list/block.native.scss +++ b/packages/block-editor/src/components/block-list/block.native.scss @@ -75,12 +75,16 @@ .selectedLeaf { margin: $block-selected-margin; - padding: $block-selected-to-content; + padding-left: $block-selected-to-content; + padding-right: $block-selected-to-content; + padding-top: $block-selected-to-content; } .selectedRootLeaf { margin: 0; - padding: $block-edge-to-content; + padding-left: $block-edge-to-content; + padding-right: $block-edge-to-content; + padding-top: $block-edge-to-content; } .selectedParent { @@ -130,3 +134,8 @@ background-color: #e9eff3; opacity: 0.4; } + +.neutralToolbar { + margin-left: -$block-edge-to-content; + margin-right: -$block-edge-to-content; +} diff --git a/packages/block-editor/src/components/block-list/breadcrumb.native.js b/packages/block-editor/src/components/block-list/breadcrumb.native.js index 0bea56e4da6ddf..6e47499b350c8d 100644 --- a/packages/block-editor/src/components/block-list/breadcrumb.native.js +++ b/packages/block-editor/src/components/block-list/breadcrumb.native.js @@ -22,7 +22,11 @@ import styles from './breadcrumb.scss'; const BlockBreadcrumb = ( { clientId, blockIcon, rootClientId, rootBlockIcon } ) => { return ( - {/* Open BottomSheet with markup */} }> + {/* Open BottomSheet with markup */} } + disabled={ true } /* Disable temporarily since onPress function is empty */ + > { rootClientId && rootBlockIcon && ( [ , , diff --git a/packages/block-library/src/media-text/style.native.scss b/packages/block-library/src/media-text/style.native.scss index 24c06303501330..75fb16c740df81 100644 --- a/packages/block-library/src/media-text/style.native.scss +++ b/packages/block-library/src/media-text/style.native.scss @@ -34,7 +34,6 @@ .contentCentered { flex: 1; - justify-content: center; align-items: center; } diff --git a/packages/block-library/src/missing/index.js b/packages/block-library/src/missing/index.js index 301efedc3b8265..3b9f0c48c13956 100644 --- a/packages/block-library/src/missing/index.js +++ b/packages/block-library/src/missing/index.js @@ -16,7 +16,7 @@ export { metadata, name }; export const settings = { name, - title: __( 'Unrecognized Block' ), + title: __( 'Unsupported' ), description: __( 'Your site doesn’t include support for this block.' ), supports: { className: false, diff --git a/packages/components/src/button/index.native.js b/packages/components/src/button/index.native.js index 1c6db4c0e53c50..4b2c92b3194bb2 100644 --- a/packages/components/src/button/index.native.js +++ b/packages/components/src/button/index.native.js @@ -125,8 +125,8 @@ export function Button( props ) { ) ); - const newIcon = cloneElement( ( icon && ), - { colorScheme: props.preferredColorScheme, isPressed } ); + const newIcon = icon ? cloneElement( ( ), + { colorScheme: props.preferredColorScheme, isPressed } ) : null; const element = ( Date: Fri, 10 Jan 2020 18:42:09 +0100 Subject: [PATCH 2/2] Revert travis changes --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8798f87bb55da5..122858672c93e9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,7 @@ branches: only: - master - rnmobile/master - - /rnmobile\/release.*/ + - rnmobile/releases - /wp\/.*/ env: