Skip to content

fix(markdown): list editor components alphabetically in toolbar#7759

Merged
martinjagodic merged 3 commits intodecaporg:mainfrom
domcleal:markdown-toolbar-plugin-order
Mar 23, 2026
Merged

fix(markdown): list editor components alphabetically in toolbar#7759
martinjagodic merged 3 commits intodecaporg:mainfrom
domcleal:markdown-toolbar-plugin-order

Conversation

@domcleal
Copy link
Copy Markdown
Contributor

Summary

The list of editor components in the Markdown widget's dropdown menu is in an unpredictable order. As the list of components on our site has grown quite long, it's become increasingly difficult to find what you're looking for.

Editor components are registered in an unpredictable order and then stored in an unordered map, so this changes the toolbar to display components in a human-friendly alphabetical order.

Test plan

Open the demo site, Posts collection, check the + list of components on the post body.

Previously:

image

Now:

image

Checklist

Please add a x inside each checkbox:

A picture of a cute animal (not mandatory but encouraged)

image

@domcleal domcleal requested a review from a team as a code owner March 20, 2026 10:04
As editor components are registered in an unpredictable order and stored
in an unordered map, ensure the dropdown menu lists widgets in a more
human-friendly order at display-time.
@domcleal domcleal force-pushed the markdown-toolbar-plugin-order branch from 0ff19fc to 96d05c9 Compare March 20, 2026 10:11
Copy link
Copy Markdown
Member

@martinjagodic martinjagodic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the submission. This helps, but I would not override the order if editor_components is set.

With your PR, in this widget:

{ label: 'Body', name: 'body', editor_components: ['youtube', 'image'], widget: 'markdown' }

The order is Image, Youtube, but I would like to see it as defined: Youtube, Image

When the Markdown widget has a defined list of editor components, they
will now be displayed in the same order as configured - making the order
fully user-controlled. Only when the editor component list is missing
will the default components be listed alphabetically.
@domcleal
Copy link
Copy Markdown
Contributor Author

This helps, but I would not override the order if editor_components is set.

Thanks @martinjagodic, good point. I've made that change to the PR, preferring the editor_components order if it's given, else using an alphabetical list of all plugins.

@martinjagodic martinjagodic enabled auto-merge (squash) March 23, 2026 14:39
@martinjagodic martinjagodic merged commit 81cc055 into decaporg:main Mar 23, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants