diff --git a/core-blocks/index.js b/core-blocks/index.js index a6c83b08da036f..d3a888838a37a3 100644 --- a/core-blocks/index.js +++ b/core-blocks/index.js @@ -7,6 +7,7 @@ import { setUnknownTypeHandlerName, } from '@wordpress/blocks'; import { deprecated } from '@wordpress/utils'; +import { dispatch } from '@wordpress/data'; /** * Internal dependencies @@ -78,11 +79,15 @@ export const registerCoreBlocks = () => { table, textColumns, verse, - video, ].forEach( ( { name, settings } ) => { registerBlockType( name, settings ); } ); + [ video ].forEach( ( { name, definition, implementation } ) => { + dispatch( 'core/blocks' ).addBlockTypes( { name, ...definition } ); + dispatch( 'core/blocks' ).implementBlockTypes( { name, ...implementation } ); + } ); + setDefaultBlockName( paragraph.name ); setUnknownTypeHandlerName( freeform.name ); }; diff --git a/core-blocks/video/index.js b/core-blocks/video/index.js index 891ac72c6737d2..db5e47c7e6f06e 100644 --- a/core-blocks/video/index.js +++ b/core-blocks/video/index.js @@ -30,15 +30,10 @@ import './editor.scss'; export const name = 'core/video'; -export const settings = { +export const definition = { title: __( 'Video' ), - description: __( 'Embed an video file and a simple video player.' ), - - icon: 'format-video', - category: 'common', - attributes: { align: { type: 'string', @@ -48,12 +43,23 @@ export const settings = { }, src: { type: 'string', + }, + caption: { + type: 'array', + }, + }, +}; + +export const implementation = { + icon: 'format-video', + + attributes: { + src: { source: 'attribute', selector: 'video', attribute: 'src', }, caption: { - type: 'array', source: 'children', selector: 'figcaption', },