From fa7172ff95e134310791b848cd3284075fdf8014 Mon Sep 17 00:00:00 2001 From: etoledom Date: Fri, 25 Oct 2019 12:39:33 +0200 Subject: [PATCH 1/9] Force block inserter to re-render on device rotation (#18101) * Force block inserter to re-render on device rotation * Dummy * Revert "Dummy" This reverts commit 037f076679cb8f89a65ecafdd9130465a0fc03d9. --- .../src/components/inserter/menu.native.js | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/packages/block-editor/src/components/inserter/menu.native.js b/packages/block-editor/src/components/inserter/menu.native.js index a03e5f818540c..591932dde8ab6 100644 --- a/packages/block-editor/src/components/inserter/menu.native.js +++ b/packages/block-editor/src/components/inserter/menu.native.js @@ -21,6 +21,15 @@ import { BottomSheet, Icon } from '@wordpress/components'; import styles from './style.scss'; export class InserterMenu extends Component { + constructor() { + super( ...arguments ); + + this.onLayout = this.onLayout.bind( this ); + this.state = { + numberOfColumns: this.calculateNumberOfColumns(), + }; + } + componentDidMount() { this.onOpen(); } @@ -47,9 +56,13 @@ export class InserterMenu extends Component { this.props.hideInsertionPoint(); } + onLayout() { + const numberOfColumns = this.calculateNumberOfColumns(); + this.setState( { numberOfColumns } ); + } + render() { const { getStylesFromColorScheme } = this.props; - const numberOfColumns = this.calculateNumberOfColumns(); const bottomPadding = styles.contentBottomPadding; const modalIconWrapperStyle = getStylesFromColorScheme( styles.modalIconWrapper, styles.modalIconWrapperDark ); const modalIconStyle = getStylesFromColorScheme( styles.modalIcon, styles.modalIconDark ); @@ -63,10 +76,11 @@ export class InserterMenu extends Component { hideHeader > From 51b5de31b9be291d41a4b18866c49a7ca393c9bd Mon Sep 17 00:00:00 2001 From: Pinar Olguc Date: Fri, 25 Oct 2019 17:09:25 +0300 Subject: [PATCH 2/9] Add left right borders to inner blocks (#18109) --- .../block-editor/src/components/inner-blocks/index.native.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/block-editor/src/components/inner-blocks/index.native.js b/packages/block-editor/src/components/inner-blocks/index.native.js index 2b6a6c9320c92..6d2d4290772fa 100644 --- a/packages/block-editor/src/components/inner-blocks/index.native.js +++ b/packages/block-editor/src/components/inner-blocks/index.native.js @@ -122,6 +122,7 @@ class InnerBlocks extends Component { rootClientId={ clientId } renderAppender={ renderAppender } withFooter={ false } + isFullyBordered={ true } /> ) } From 2461051d31d849337d048aec3f3acd029b94a646 Mon Sep 17 00:00:00 2001 From: Pinar Olguc Date: Fri, 25 Oct 2019 18:59:00 +0300 Subject: [PATCH 3/9] [Mobile]Remove alignment options from Media & Text until they are fixed (#18112) * Remove alignment options temporarily * Dummy commit --- .../block-library/src/media-text/edit.native.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/packages/block-library/src/media-text/edit.native.js b/packages/block-library/src/media-text/edit.native.js index 73532a322916a..f83092d287431 100644 --- a/packages/block-library/src/media-text/edit.native.js +++ b/packages/block-library/src/media-text/edit.native.js @@ -10,7 +10,7 @@ import { View } from 'react-native'; import { __, _x } from '@wordpress/i18n'; import { BlockControls, - BlockVerticalAlignmentToolbar, + // BlockVerticalAlignmentToolbar, InnerBlocks, withColors, } from '@wordpress/block-editor'; @@ -131,15 +131,16 @@ class MediaTextEdit extends Component { attributes, backgroundColor, setAttributes, - isMobile, + // isMobile, } = this.props; const { - isStackedOnMobile, + // isStackedOnMobile, mediaPosition, mediaWidth, verticalAlignment, } = attributes; - const shouldStack = isStackedOnMobile && isMobile; + const shouldStack = false; // We are temporarily not stacking until we fix alignment buttons + // const shouldStack = isStackedOnMobile && isMobile; // <<< Original line const temporaryMediaWidth = shouldStack ? 100 : ( this.state.mediaWidth || mediaWidth ); const widthString = `${ temporaryMediaWidth }%`; const containerStyles = { @@ -165,9 +166,9 @@ class MediaTextEdit extends Component { onClick: () => setAttributes( { mediaPosition: 'right' } ), } ]; - const onVerticalAlignmentChange = ( alignment ) => { + /* const onVerticalAlignmentChange = ( alignment ) => { setAttributes( { verticalAlignment: alignment } ); - }; + }; */ return ( <> @@ -175,11 +176,12 @@ class MediaTextEdit extends Component { + { /* // Temporarily commenting out until alignment functionality is fixed + /> */ } From 6506bfccd4f905e539595ae8237951193f67fcb8 Mon Sep 17 00:00:00 2001 From: Drapich Piotr Date: Mon, 28 Oct 2019 11:23:32 +0100 Subject: [PATCH 4/9] Fix: remove getItemLayout which causes scroll position issue (#18060) --- .../block-editor/src/components/block-list/index.native.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/block-editor/src/components/block-list/index.native.js b/packages/block-editor/src/components/block-list/index.native.js index 05c2898899ca3..b925a724809ec 100644 --- a/packages/block-editor/src/components/block-list/index.native.js +++ b/packages/block-editor/src/components/block-list/index.native.js @@ -96,9 +96,6 @@ export class BlockList extends Component { ListHeaderComponent={ header } ListEmptyComponent={ this.renderDefaultBlockAppender } ListFooterComponent={ withFooter && this.renderBlockListFooter } - getItemLayout={ ( data, index ) => { - return { length: 0, offset: 0, index }; - } } /> { renderAppender && blockClientIds.length > 0 && From 9645d94b1fa02208231b5c3bfecd2aff4d03f4de Mon Sep 17 00:00:00 2001 From: Pinar Olguc Date: Tue, 29 Oct 2019 11:44:55 +0300 Subject: [PATCH 5/9] Fix: Media & Text Loses upload status if post is closed/reopened during the upload (#18137) * Prevent deleting mediaType on upload progress * Call onMediaUpdate instead of onSelectMedia * Dummy commit * Revert "Dummy commit" This reverts commit 5ce06d61f74af688b9d938c99e2d9fdad090a42c. * Limit requestMediaImport calls for only image type * Update comment --- .../src/media-text/media-container.native.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/packages/block-library/src/media-text/media-container.native.js b/packages/block-library/src/media-text/media-container.native.js index d929f08d9f4c9..39ff78799b14f 100644 --- a/packages/block-library/src/media-text/media-container.native.js +++ b/packages/block-library/src/media-text/media-container.native.js @@ -62,17 +62,14 @@ class MediaContainer extends Component { } componentDidMount() { - const { mediaId, mediaUrl, onSelectMedia } = this.props; + const { mediaId, mediaUrl, onMediaUpdate, mediaType } = this.props; if ( mediaId && mediaUrl && ! isURL( mediaUrl ) ) { - if ( mediaUrl.indexOf( 'file:' ) === 0 ) { - requestMediaImport( mediaUrl, ( id, url, type ) => { + if ( mediaUrl.indexOf( 'file:' ) === 0 && mediaType === MEDIA_TYPE_IMAGE ) { + // We don't want to call this for video because it is starting a media upload for the cover url + requestMediaImport( mediaUrl, ( id, url ) => { if ( url ) { - onSelectMedia( { - media_type: type, - id, - url, - } ); + onMediaUpdate( { id, url } ); } } ); } From 99584e41b097792d61370e9a0ac3c9ab52cf9bf4 Mon Sep 17 00:00:00 2001 From: etoledom Date: Tue, 29 Oct 2019 16:47:35 +0100 Subject: [PATCH 6/9] Dummy commit --- dumb | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 dumb diff --git a/dumb b/dumb new file mode 100644 index 0000000000000..e69de29bb2d1d From e3a6b96f5efcc25ee497beb68fbdafcb15390636 Mon Sep 17 00:00:00 2001 From: etoledom Date: Tue, 29 Oct 2019 16:48:11 +0100 Subject: [PATCH 7/9] Revert "Dummy commit" This reverts commit 99584e41b097792d61370e9a0ac3c9ab52cf9bf4. --- dumb | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 dumb diff --git a/dumb b/dumb deleted file mode 100644 index e69de29bb2d1d..0000000000000 From 13ba7dca67ac4c82851e0a6cf2504009ae6db6e5 Mon Sep 17 00:00:00 2001 From: Jorge Bernal Date: Fri, 1 Nov 2019 11:16:13 +0100 Subject: [PATCH 8/9] Fix handling of pasted images and prevent thumbnail uploads (#18215) * Fix handling of pasted images and prevent thumbnail uploads * Fix lint errors * Remove check for image for sync. --- .../block-library/src/image/edit.native.js | 18 +++++++++++------- .../src/media-text/media-container.native.js | 17 +++++------------ 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/packages/block-library/src/image/edit.native.js b/packages/block-library/src/image/edit.native.js index 53334a888dd94..1d9274c375469 100644 --- a/packages/block-library/src/image/edit.native.js +++ b/packages/block-library/src/image/edit.native.js @@ -104,14 +104,18 @@ export class ImageEdit extends React.Component { console.warn( 'Attributes has id with no url.' ); } + // Detect any pasted image and start an upload + if ( ! attributes.id && attributes.url && attributes.url.indexOf( 'file:' ) === 0 ) { + requestMediaImport( attributes.url, ( id, url ) => { + if ( url ) { + setAttributes( { id, url } ); + } + } ); + } + + // Make sure we mark any temporary images as failed if they failed while + // the editor wasn't open if ( attributes.id && attributes.url && ! isURL( attributes.url ) ) { - if ( attributes.url.indexOf( 'file:' ) === 0 ) { - requestMediaImport( attributes.url, ( id, url ) => { - if ( url ) { - setAttributes( { id, url } ); - } - } ); - } mediaUploadSync(); } } diff --git a/packages/block-library/src/media-text/media-container.native.js b/packages/block-library/src/media-text/media-container.native.js index 84d2c6dc836bd..fea6a9671965c 100644 --- a/packages/block-library/src/media-text/media-container.native.js +++ b/packages/block-library/src/media-text/media-container.native.js @@ -3,7 +3,6 @@ */ import { View, ImageBackground, Text, TouchableWithoutFeedback } from 'react-native'; import { - requestMediaImport, mediaUploadSync, requestImageFailedRetryDialog, requestImageUploadCancelDialog, @@ -62,17 +61,11 @@ class MediaContainer extends Component { } componentDidMount() { - const { mediaId, mediaUrl, onMediaUpdate, mediaType } = this.props; - - if ( mediaId && mediaUrl && ! isURL( mediaUrl ) ) { - if ( mediaUrl.indexOf( 'file:' ) === 0 && mediaType === MEDIA_TYPE_IMAGE ) { - // We don't want to call this for video because it is starting a media upload for the cover url - requestMediaImport( mediaUrl, ( id, url ) => { - if ( url ) { - onMediaUpdate( { id, url } ); - } - } ); - } + const { mediaId, mediaUrl } = this.props; + + // Make sure we mark any temporary images as failed if they failed while + // the editor wasn't open + if ( mediaId && mediaUrl && mediaUrl.indexOf( 'file:' ) === 0 ) { mediaUploadSync(); } } From 76c9c4b1fbf3a90ad8d62245d811849ef65ec31e Mon Sep 17 00:00:00 2001 From: Stefanos Togkoulidis Date: Fri, 1 Nov 2019 13:32:41 +0200 Subject: [PATCH 9/9] Include the RN mobile releases branch in Travis branches --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 32e41294c57f9..db9acbf2d2174 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,6 +21,7 @@ branches: only: - master - rnmobile/master + - rnmobile/releases - /wp\/.*/ env: