From 10158173e3b30d6daf60b4dda02f2acf0f200b5a Mon Sep 17 00:00:00 2001 From: akasunil Date: Sun, 21 Jul 2024 16:12:37 +0530 Subject: [PATCH 01/13] Add border support to video block --- packages/block-library/src/video/block.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/block-library/src/video/block.json b/packages/block-library/src/video/block.json index 1d3dc75961e8f1..99eec2949f2de4 100644 --- a/packages/block-library/src/video/block.json +++ b/packages/block-library/src/video/block.json @@ -95,6 +95,18 @@ }, "interactivity": { "clientNavigation": true + }, + "__experimentalBorder": { + "radius": true, + "color": true, + "width": true, + "style": true, + "__experimentalDefaultControls": { + "radius": true, + "color": true, + "width": true, + "style": true + } } }, "editorStyle": "wp-block-video-editor", From ca2d2ef23b1a40a18ef36375da0bb4b42915c301 Mon Sep 17 00:00:00 2001 From: akasunil Date: Sun, 11 Aug 2024 21:19:20 +0530 Subject: [PATCH 02/13] Skip serialisation of border styles and add selectors --- packages/block-library/src/video/block.json | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/block-library/src/video/block.json b/packages/block-library/src/video/block.json index 99eec2949f2de4..5e29e9695117eb 100644 --- a/packages/block-library/src/video/block.json +++ b/packages/block-library/src/video/block.json @@ -101,14 +101,12 @@ "color": true, "width": true, "style": true, - "__experimentalDefaultControls": { - "radius": true, - "color": true, - "width": true, - "style": true - } + "__experimentalSkipSerialization": true } }, + "selectors": { + "border": ".wp-block-video video, .wp-block-video .components-placeholder" + }, "editorStyle": "wp-block-video-editor", "style": "wp-block-video" } From b1d5c63a4f917fcc98d9064f79b05f455dabee94 Mon Sep 17 00:00:00 2001 From: akasunil Date: Sun, 11 Aug 2024 21:20:46 +0530 Subject: [PATCH 03/13] Implement border style on video tag in edit component --- packages/block-library/src/video/edit.js | 43 ++++++++++++++---------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/packages/block-library/src/video/edit.js b/packages/block-library/src/video/edit.js index 97a6e148d5d069..f55e14b8147191 100644 --- a/packages/block-library/src/video/edit.js +++ b/packages/block-library/src/video/edit.js @@ -24,6 +24,7 @@ import { MediaUploadCheck, MediaReplaceFlow, useBlockProps, + __experimentalUseBorderProps as useBorderProps, } from '@wordpress/block-editor'; import { useRef, useEffect, useState } from '@wordpress/element'; import { __, sprintf } from '@wordpress/i18n'; @@ -42,23 +43,6 @@ import TracksEditor from './tracks-editor'; import Tracks from './tracks'; import { Caption } from '../utils/caption'; -// Much of this description is duplicated from MediaPlaceholder. -const placeholder = ( content ) => { - return ( - - { content } - - ); -}; - const ALLOWED_MEDIA_TYPES = [ 'video' ]; const VIDEO_POSTER_ALLOWED_MEDIA_TYPES = [ 'image' ]; @@ -75,6 +59,7 @@ function VideoEdit( { const posterImageButton = useRef(); const { id, controls, poster, src, tracks } = attributes; const [ temporaryURL, setTemporaryURL ] = useState( attributes.blob ); + const borderProps = useBorderProps( attributes ); useUploadMediaFromBlobURL( { url: temporaryURL, @@ -157,6 +142,26 @@ function VideoEdit( { className: classes, } ); + // Much of this description is duplicated from MediaPlaceholder. + const placeholder = ( content ) => { + return ( + + { content } + + ); + }; + if ( ! src && ! temporaryURL ) { return (
@@ -277,9 +282,13 @@ function VideoEdit( { */ }