Skip to content

Commit

Permalink
RichText: Update registration method signature (#11109)
Browse files Browse the repository at this point in the history
  • Loading branch information
gziolo authored and ellatrix committed Oct 26, 2018
1 parent ce8f61d commit ac3d50e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/format-library/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ import {
italic,
link,
strikethrough,
].forEach( registerFormatType );
].forEach( ( { name, ...settings } ) => registerFormatType( name, settings ) );
8 changes: 7 additions & 1 deletion packages/rich-text/src/register-format-type.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,18 @@ import { isValidIcon, normalizeIconObject } from '@wordpress/blocks';
* Registers a new format provided a unique name and an object defining its
* behavior.
*
* @param {string} name Format name.
* @param {Object} settings Format settings.
*
* @return {?WPFormat} The format, if it has been successfully registered;
* otherwise `undefined`.
*/
export function registerFormatType( settings ) {
export function registerFormatType( name, settings ) {
settings = {
name,
...settings,
};

if ( typeof settings.name !== 'string' ) {
window.console.error(
'Format names must be strings.'
Expand Down

0 comments on commit ac3d50e

Please sign in to comment.