Skip to content

Commit

Permalink
Remove getBlockNames
Browse files Browse the repository at this point in the history
  • Loading branch information
jsnajdr committed Jul 26, 2023
1 parent 1dde417 commit 410cf61
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
5 changes: 0 additions & 5 deletions packages/blocks/src/store/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,6 @@ export const getBlockTypes = createSelector(
( state ) => [ state.blockTypes ]
);

export const getBlockNames = createSelector(
( state ) => Object.keys( state.bootstrappedBlockTypes ),
( state ) => [ state.bootstrappedBlockTypes ]
);

export const getBootstrappedBlockTypes = createSelector(
( state ) => Object.values( state.bootstrappedBlockTypes ),
( state ) => [ state.bootstrappedBlockTypes ]
Expand Down
10 changes: 5 additions & 5 deletions packages/edit-post/src/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function Editor( { postId, postType, settings, initialEdits, ...props } ) {
post,
preferredStyleVariations,
hiddenBlockTypes,
blockNames,
blockTypes,
keepCaretInsideBlock,
isTemplateMode,
template,
Expand All @@ -58,7 +58,7 @@ function Editor( { postId, postType, settings, initialEdits, ...props } ) {
const { getEntityRecord, getPostType, getEntityRecords, canUser } =
select( coreStore );
const { getEditorSettings } = select( editorStore );
const { getBlockNames } = select( blocksStore );
const { getBootstrappedBlockTypes } = select( blocksStore );
const isTemplate = [ 'wp_template', 'wp_template_part' ].includes(
postType
);
Expand Down Expand Up @@ -89,7 +89,7 @@ function Editor( { postId, postType, settings, initialEdits, ...props } ) {
'preferredStyleVariations'
),
hiddenBlockTypes: getHiddenBlockTypes(),
blockNames: getBlockNames(),
blockTypes: getBootstrappedBlockTypes(),
keepCaretInsideBlock: isFeatureActive( 'keepCaretInsideBlock' ),
isTemplateMode: isEditingTemplate(),
template:
Expand Down Expand Up @@ -132,7 +132,7 @@ function Editor( { postId, postType, settings, initialEdits, ...props } ) {
// all block types).
const defaultAllowedBlockTypes =
true === settings.allowedBlockTypes
? blockNames
? blockTypes.map( ( { name } ) => name )
: settings.allowedBlockTypes || [];

result.allowedBlockTypes = defaultAllowedBlockTypes.filter(
Expand All @@ -148,7 +148,7 @@ function Editor( { postId, postType, settings, initialEdits, ...props } ) {
focusMode,
isDistractionFree,
hiddenBlockTypes,
blockNames,
blockTypes,
preferredStyleVariations,
setIsInserterOpened,
updatePreferredStyleVariations,
Expand Down

0 comments on commit 410cf61

Please sign in to comment.