diff --git a/packages/editor/src/components/rich-text/format-edit.js b/packages/editor/src/components/rich-text/format-edit.js index d282e65743ea43..a0c021e60e259d 100644 --- a/packages/editor/src/components/rich-text/format-edit.js +++ b/packages/editor/src/components/rich-text/format-edit.js @@ -2,8 +2,9 @@ * WordPress dependencies */ import { normalizeIconObject } from '@wordpress/blocks'; +import { withSelect } from '@wordpress/data'; import { Component, Fragment } from '@wordpress/element'; -import { getActiveFormat, getFormatTypes } from '@wordpress/rich-text'; +import { getActiveFormat } from '@wordpress/rich-text'; import { Fill, KeyboardShortcuts, ToolbarButton } from '@wordpress/components'; import { rawShortcut, displayShortcut } from '@wordpress/keycodes'; @@ -81,10 +82,10 @@ class Shortcut extends Component { } } -const FormatEdit = ( { onChange, value } ) => { +const FormatEdit = ( { formatTypes, onChange, value } ) => { return ( - { getFormatTypes().map( ( { name, edit: Edit, keywords } ) => { + { formatTypes.map( ( { name, edit: Edit, keywords } ) => { if ( ! Edit ) { return null; } @@ -115,4 +116,12 @@ const FormatEdit = ( { onChange, value } ) => { ); }; -export default FormatEdit; +export default withSelect( + ( select ) => { + const { getFormatTypes } = select( 'core/rich-text' ); + + return { + formatTypes: getFormatTypes(), + }; + } +)( FormatEdit ); diff --git a/packages/editor/src/index.js b/packages/editor/src/index.js index 2f2ba832893417..43cf7442800ca4 100644 --- a/packages/editor/src/index.js +++ b/packages/editor/src/index.js @@ -5,6 +5,7 @@ import '@wordpress/blocks'; import '@wordpress/core-data'; import '@wordpress/notices'; import '@wordpress/nux'; +import '@wordpress/rich-text'; import '@wordpress/viewport'; /** diff --git a/packages/rich-text/src/index.js b/packages/rich-text/src/index.js index 05c1340d5b3459..61e6475dc778a6 100644 --- a/packages/rich-text/src/index.js +++ b/packages/rich-text/src/index.js @@ -5,8 +5,6 @@ export { charAt } from './char-at'; export { concat } from './concat'; export { create } from './create'; export { getActiveFormat } from './get-active-format'; -export { getFormatType } from './get-format-type'; -export { getFormatTypes } from './get-format-types'; export { getSelectionEnd } from './get-selection-end'; export { getSelectionStart } from './get-selection-start'; export { getTextContent } from './get-text-content';