Skip to content

Commit

Permalink
Bringing back the removeNavigationBlockEditUnsupportedFeatures, which…
Browse files Browse the repository at this point in the history
… hides the ability to toggle submenu indicators.
  • Loading branch information
shaunandrews committed Feb 5, 2021
1 parent c36468a commit 931b6b4
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions packages/edit-navigation/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
__experimentalRegisterExperimentalCoreBlocks,
} from '@wordpress/block-library';
import { render } from '@wordpress/element';
import { createHigherOrderComponent } from '@wordpress/compose';
import { __ } from '@wordpress/i18n';
import apiFetch from '@wordpress/api-fetch';
import { addQueryArgs } from '@wordpress/url';
Expand Down Expand Up @@ -47,6 +48,24 @@ function removeNavigationBlockSettingsUnsupportedFeatures( settings, name ) {
};
}

const removeNavigationBlockEditUnsupportedFeatures = createHigherOrderComponent(
( BlockEdit ) => ( props ) => {
if ( props.name !== 'core/navigation' ) {
return <BlockEdit { ...props } />;
}

return (
<BlockEdit
{ ...props }
hasSubmenuIndicatorSetting={ false }
hasItemJustificationControls={ false }
hasListViewModal={ false }
/>
);
},
'removeNavigationBlockEditUnsupportedFeatures'
);

/**
* Fetches link suggestions from the API. This function is an exact copy of a function found at:
*
Expand Down Expand Up @@ -137,6 +156,12 @@ export function initialize( id, settings ) {
removeNavigationBlockSettingsUnsupportedFeatures
);

addFilter(
'editor.BlockEdit',
'core/edit-navigation/remove-navigation-block-edit-unsupported-features',
removeNavigationBlockEditUnsupportedFeatures
);

registerCoreBlocks();

if ( process.env.GUTENBERG_PHASE === 2 ) {
Expand Down

0 comments on commit 931b6b4

Please sign in to comment.