@@ -54,40 +86,4 @@ const PostFormatPanel = ( { suggestion, onUpdatePostFormat } ) => {
);
-};
-
-const getSuggestion = ( supportedFormats, suggestedPostFormat ) => {
- const formats = POST_FORMATS.filter( ( format ) =>
- includes( supportedFormats, format.id )
- );
- return find( formats, ( format ) => format.id === suggestedPostFormat );
-};
-
-export default compose(
- withSelect( ( select ) => {
- const { getEditedPostAttribute, getSuggestedPostFormat } = select(
- 'core/editor'
- );
- const supportedFormats = get(
- select( 'core' ).getThemeSupports(),
- [ 'formats' ],
- []
- );
- return {
- currentPostFormat: getEditedPostAttribute( 'format' ),
- suggestion: getSuggestion(
- supportedFormats,
- getSuggestedPostFormat()
- ),
- };
- } ),
- withDispatch( ( dispatch ) => ( {
- onUpdatePostFormat( postFormat ) {
- dispatch( 'core/editor' ).editPost( { format: postFormat } );
- },
- } ) ),
- ifCondition(
- ( { suggestion, currentPostFormat } ) =>
- suggestion && suggestion.id !== currentPostFormat
- )
-)( PostFormatPanel );
+}