fix: sort Advanced Blocks by default display name (#1817)

This commit is contained in:
Jillian
2025-04-16 05:37:21 +09:30
committed by GitHub
parent aa8a5bfba4
commit afecd8ba83

View File

@@ -154,6 +154,10 @@ const AddAdvancedContentView = ({
isBlockTypeEnabled,
}: AddAdvancedContentViewProps) => {
const intl = useIntl();
// Sort block types alphabetically by default display name
const sortedBlockTypes = Object.keys(advancedBlocks).sort((typeA, typeB) => (
advancedBlocks[typeA].displayName.localeCompare(advancedBlocks[typeB].displayName)
));
return (
<>
<div className="d-flex">
@@ -161,7 +165,7 @@ const AddAdvancedContentView = ({
{intl.formatMessage(messages.backToAddContentListButton)}
</Button>
</div>
{Object.keys(advancedBlocks).map((blockType) => (
{sortedBlockTypes.map((blockType) => (
isBlockTypeEnabled(blockType) ? (
<AddContentButton
key={`add-content-${blockType}`}