feat(ui): custom ordering for rte fixed toolbar #12095
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
This PR introduces a customizable ordering system for toolbar groups in the Lexical Rich Text Editor. It allows developers to override the default order of toolbar components (such as format, align, indent) by specifying custom order values through the
FixedToolbarFeature
configuration.Why
Previously, toolbar group ordering was hardcoded in each component (e.g., format group had order=40, align group had order=30, etc.). This made it impossible for developers to rearrange these components without modifying the source code.
This enhancement provides more flexibility for customizing the rich text editor interface to match specific project requirements or design preferences, without compromising the default behavior for users who don't need customization.
How
The implementation consists of three key parts:
customGroupOrders
property toFixedToolbarFeatureProps
that accepts a record mapping group keys to custom order valuessanitizeClientFeatures
function to detect and collect custom order configurations from toolbar featuresUsage Example
Before
before.mov
After
after.mov