From 7a8185210255b8d22cbe33aa1ed89253900928ed Mon Sep 17 00:00:00 2001 From: Andrei Draganescu Date: Mon, 16 Dec 2019 13:02:28 +0200 Subject: [PATCH 1/3] adds the new replace flow to the video block --- packages/block-library/src/video/edit.js | 25 ++++++++++-------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/packages/block-library/src/video/edit.js b/packages/block-library/src/video/edit.js index 05f7b2bc1b9d4e..e60ce5852700cf 100644 --- a/packages/block-library/src/video/edit.js +++ b/packages/block-library/src/video/edit.js @@ -7,7 +7,6 @@ import { Button, Disabled, PanelBody, - ToolbarGroup, withNotices, } from '@wordpress/components'; import { @@ -17,6 +16,7 @@ import { MediaPlaceholder, MediaUpload, MediaUploadCheck, + MediaReplaceFlow, RichText, } from '@wordpress/block-editor'; import { Component, createRef } from '@wordpress/element'; @@ -146,16 +146,11 @@ class VideoEdit extends Component { attributes, setAttributes, } = this.props; - const { editing } = this.state; - const switchToEditing = () => { - this.setState( { editing: true } ); - }; const onSelectVideo = ( media ) => { if ( ! media || ! media.url ) { // in this case there was an error and we should continue in the editing state // previous attributes should be removed because they may be temporary blob urls setAttributes( { src: undefined, id: undefined } ); - switchToEditing(); return; } // sets the block's attribute and updates the edit component from the @@ -164,7 +159,7 @@ class VideoEdit extends Component { this.setState( { src: media.url, editing: false } ); }; - if ( editing ) { + if ( ! src ) { return ( } @@ -184,14 +179,14 @@ class VideoEdit extends Component { return ( <> - -