diff --git a/blocks/api/registration.js b/blocks/api/registration.js index 13eeaecca6777..cd7b5e546cad3 100644 --- a/blocks/api/registration.js +++ b/blocks/api/registration.js @@ -119,19 +119,15 @@ export function registerBlockType( name, settings ) { settings.icon = 'block-default'; } - const attributes = settings.attributes ? - settings.attributes : - get( window._wpBlocksAttributes, name, {} ); - - let block = blocks[ name ] = { - ...settings, + settings = { name, - attributes, + attributes: get( window._wpBlocksAttributes, name, {} ), + ...settings, }; - block = applyFilters( 'registerBlockType', block, name ); + settings = applyFilters( 'registerBlockType', settings, name ); - return blocks[ name ] = block; + return blocks[ name ] = settings; } /** diff --git a/blocks/hooks/anchor.js b/blocks/hooks/anchor.js index 00274520932e8..a674a6ba57bf5 100644 --- a/blocks/hooks/anchor.js +++ b/blocks/hooks/anchor.js @@ -12,7 +12,7 @@ import { __ } from '@wordpress/i18n'; /** * Internal dependencies */ -import { source, hasBlockSupport } from '../api'; +import { hasBlockSupport } from '../api'; import InspectorControls from '../inspector-controls'; /** @@ -35,7 +35,9 @@ export function addAttribute( settings ) { settings.attributes = assign( settings.attributes, { anchor: { type: 'string', - source: source.attr( '*', 'id' ), + source: 'attribute', + attribute: 'id', + selector: '*', }, } ); }