From 3e5cdd9a1ca2ef8f731dffc59607d7874d29c2d4 Mon Sep 17 00:00:00 2001 From: Chris Hall Date: Fri, 20 Sep 2024 10:59:39 +0100 Subject: [PATCH] feat: adds in functions to sort blocks/elements by title/name --- src/editor/components/NavBlockList.js | 7 ++++++- src/editor/components/NavElementList.js | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/editor/components/NavBlockList.js b/src/editor/components/NavBlockList.js index 5beb3b3..5e2857b 100644 --- a/src/editor/components/NavBlockList.js +++ b/src/editor/components/NavBlockList.js @@ -22,10 +22,15 @@ const NavBlockList = () => { // get styles for all blocks const themeBlockStyles = getThemeOption( `styles.blocks`, themeConfig ); + // sort the blocks by title + const orderedSchema = schemaBlocks.sort( ( a, b ) => + a.title.localeCompare( b.title ) + ); + return (