diff --git a/.travis.yml b/.travis.yml index 32e41294c57f9c..db9acbf2d2174b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,6 +21,7 @@ branches: only: - master - rnmobile/master + - rnmobile/releases - /wp\/.*/ env: diff --git a/packages/block-library/src/image/edit.native.js b/packages/block-library/src/image/edit.native.js index 53334a888dd946..1d9274c3754697 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 84d2c6dc836bde..fea6a9671965c4 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(); } }