Skip to content

Commit

Permalink
Extensibility: Fix the anchor extension after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Nov 16, 2017
1 parent 032ddc4 commit 2aeb51a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
14 changes: 5 additions & 9 deletions blocks/api/registration.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down
6 changes: 4 additions & 2 deletions blocks/hooks/anchor.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { __ } from '@wordpress/i18n';
/**
* Internal dependencies
*/
import { source, hasBlockSupport } from '../api';
import { hasBlockSupport } from '../api';
import InspectorControls from '../inspector-controls';

/**
Expand All @@ -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: '*',
},
} );
}
Expand Down

0 comments on commit 2aeb51a

Please sign in to comment.