Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RichText: Update registration method signature #11109

Merged
merged 1 commit into from
Oct 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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