Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix site editor rendering of Categories block
The Categories block would not render properly within the site editor.
Specifically:

- Prefix and Suffix options were not shown when the block was selected.
- Separator was not available in the advanced panel.
- Alignment toolbar was not available in the toolbar.
  • Loading branch information
sunyatasattva committed Jun 8, 2023
commit 272b81323a410411ddc84572cc5603f17c5bc0fc
15 changes: 8 additions & 7 deletions packages/block-library/src/post-terms/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,6 @@ export default function PostTermsEdit( {
} ),
} );

if ( ! hasPost || ! term ) {
return <div { ...blockProps }>{ blockInformation.title }</div>;
}

return (
<>
<BlockControls>
Expand All @@ -96,7 +92,7 @@ export default function PostTermsEdit( {
/>
</InspectorControls>
<div { ...blockProps }>
{ isLoading && <Spinner /> }
{ isLoading && hasPost && <Spinner /> }
{ ! isLoading && hasPostTerms && ( isSelected || prefix ) && (
<RichText
allowedFormats={ ALLOWED_FORMATS }
Expand All @@ -111,7 +107,11 @@ export default function PostTermsEdit( {
tagName="span"
/>
) }
{ ! isLoading &&
{ ( ! hasPost || ! term ) && (
<span>{ blockInformation.title }</span>
) }
{ hasPost &&
! isLoading &&
hasPostTerms &&
postTerms
.map( ( postTerm ) => (
Expand All @@ -132,7 +132,8 @@ export default function PostTermsEdit( {
{ curr }
</>
) ) }
{ ! isLoading &&
{ hasPost &&
! isLoading &&
! hasPostTerms &&
( selectedTerm?.labels?.no_terms ||
__( 'Term items not found.' ) ) }
Expand Down