-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch editor sidebar icons to new drawer icons Icon should reflect RTL as well. Update TabPanel to allow icons on TabButtons Add menu group to InspectorControl slot fills Move nav menu controls into InspectorControls menu group Introduce menu, settings & appearance tabs to sidebar Refactor InspectorControlTabs Re-orders the appearance and settings tabs. Also now omits the TabPanel altogether if only a single tab has contents. Make block inspector tabs a Gutenberg experiment A little tidy up Clean up conditional tabs display Remove nav specific menu tab for now Remove Menu inspector controls group Refactor inspector controls tabs to components Remove conditional display of tabs Render no settings or tools messages when no fills Reduce new styles for equal width tabs Add general slot for items applying to block as a whole Move query block new post link to new slot Revert "Move query block new post link to new slot" This reverts commit 1279985. Revert "Add general slot for items applying to block as a whole" This reverts commit 186276f. Tweak no style options message Add changelog for TabPanel updates Remove empty readme until experiment settles Fix copy and paste error Provide list view tab and slot for nav block
- Loading branch information
1 parent
2a2ecb3
commit bfb850a
Showing
6 changed files
with
77 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
packages/block-editor/src/components/inspector-controls-tabs/list-view-tab.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { __experimentalUseSlotFills as useSlotFills } from '@wordpress/components'; | ||
import { __ } from '@wordpress/i18n'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import InspectorControls from '../inspector-controls'; | ||
import InspectorControlsGroups from '../inspector-controls/groups'; | ||
|
||
// This tab restricts the blocks that may render to it via the whitelist below. | ||
const whitelist = [ 'core/navigation' ]; | ||
|
||
export const useIsListViewDisabled = ( blockName ) => { | ||
return ! whitelist.includes( blockName ); | ||
}; | ||
|
||
const ListViewTab = ( { blockName, hasSingleBlockSelection } ) => { | ||
const { list } = InspectorControlsGroups; | ||
const fills = useSlotFills( list.Slot.__unstableName ) || []; | ||
|
||
// Unlike other tabs the List View is much more niche. As such it will be | ||
// omitted if the current block isn't in the whitelist. | ||
if ( useIsListViewDisabled( blockName ) ) { | ||
return; | ||
} | ||
|
||
return ( | ||
<> | ||
{ ! fills.length && ( | ||
<span className="block-editor-block-inspector__no-block-tools"> | ||
{ hasSingleBlockSelection | ||
? __( 'This block has no list options.' ) | ||
: __( 'The selected blocks have no list options.' ) } | ||
</span> | ||
) } | ||
<InspectorControls.Slot __experimentalGroup="list" /> | ||
</> | ||
); | ||
}; | ||
|
||
export default ListViewTab; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters