Skip to content

Commit

Permalink
Append registered toolbar buttons (#11196)
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix authored and gziolo committed Oct 29, 2018
1 parent 3b66a7f commit 96fe699
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/editor/src/components/rich-text/format-edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,18 @@ function isResult( { title, keywords = [] }, filterValue ) {

function FillToolbarButton( { name, shortcutType, shortcutCharacter, ...props } ) {
let shortcut;
let fillName = 'RichText.ToolbarControls';

if ( name ) {
fillName += `.${ name }`;
}

if ( shortcutType && shortcutCharacter ) {
shortcut = displayShortcut[ shortcutType ]( shortcutCharacter );
}

return (
<Fill name={ `RichText.ToolbarControls.${ name }` }>
<Fill name={ fillName }>
<ToolbarButton
{ ...props }
shortcut={ shortcut }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const FormatToolbar = ( { controls } ) => {
{ controls.map( ( format ) =>
<Slot name={ `RichText.ToolbarControls.${ format }` } key={ format } />
) }
<Slot name="RichText.ToolbarControls" />
</Toolbar>
</div>
);
Expand Down

0 comments on commit 96fe699

Please sign in to comment.