Skip to content

Commit

Permalink
Clarify implementation only attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed May 17, 2018
1 parent 7fefed2 commit 2e88f72
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions blocks/api/registration.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,13 @@ export function registerBlockType( name, settings ) {
set( settings, [ 'supports', 'inserter' ], ! settings.isPrivate );
}

const blockTypeDefinition = omit( settings, [ 'transforms', 'edit', 'save', 'icon', 'getEditWrapperProps' ] );
const implementationOnlyAttributes = [ 'transforms', 'edit', 'save', 'icon', 'getEditWrapperProps' ];
const blockTypeDefinition = omit( settings, implementationOnlyAttributes );
blockTypeDefinition.attributes = mapValues(
settings.attributes,
( attribute ) => pick( attribute, [ 'type', 'default' ] )
);
const blockTypeImplementation = pick( settings, [ 'name', 'transforms', 'edit', 'save', 'icon', 'getEditWrapperProps' ] );
const blockTypeImplementation = pick( settings, [ 'name' ].concat( implementationOnlyAttributes ) );
blockTypeImplementation.attributes = mapValues(
settings.attributes,
( attribute ) => omit( attribute, [ 'type', 'default' ] )
Expand Down

0 comments on commit 2e88f72

Please sign in to comment.