Is your feature request related to a problem? Please describe.
Short: We would like to be able to extend BLOCK_ALIGNMENTS_CONTROLS at runtime.
My apologies in advance if this is already configurable somewhere (or if this is not in the scope of Gutenberg) as I am still getting a handle on the Gutenberg source.
Longer: We currently develop our in house CMS on top of WordPress, and we were looking to extend the default alignment options. From what I can tell we can currently define custom alignment keys in our block registrations (supports.align) or filter existing block registrations to add additional alignment keys. While they are technically functional, these alignments do not have icons or titles in the AlignmentToolbar as they are not present in the BLOCK_ALIGNMENTS_CONTROLS object that is defined in https://github.com/WordPress/gutenberg/blob/master/packages/block-editor/src/components/block-alignment-toolbar/index.js
Describe the solution you'd like
A filter we could hook with a function that would return the extended BLOCK_ALIGNMENTS_CONTROLS. This filter would then be invoked by the AlignmentToolbar instead of the referencing the BLOCK_ALIGNMENTS_CONTROLS object.
Describe alternatives you've considered
I think this functionality could also be handled by a registration model with a store, but that seems like a lot of extra work. I'm sure there are other options, but I'm not familiar enough with Gutenberg internals to suggest them.
Alternatively we can certainly solve this with a self-built version of Gutenberg, but we prefer to stay with the version distributed with WordPress releases if possible.
Is your feature request related to a problem? Please describe.
Short: We would like to be able to extend
BLOCK_ALIGNMENTS_CONTROLSat runtime.My apologies in advance if this is already configurable somewhere (or if this is not in the scope of Gutenberg) as I am still getting a handle on the Gutenberg source.
Longer: We currently develop our in house CMS on top of WordPress, and we were looking to extend the default alignment options. From what I can tell we can currently define custom alignment keys in our block registrations (
supports.align) or filter existing block registrations to add additional alignment keys. While they are technically functional, these alignments do not have icons or titles in the AlignmentToolbar as they are not present in theBLOCK_ALIGNMENTS_CONTROLSobject that is defined in https://github.com/WordPress/gutenberg/blob/master/packages/block-editor/src/components/block-alignment-toolbar/index.jsDescribe the solution you'd like
A filter we could hook with a function that would return the extended
BLOCK_ALIGNMENTS_CONTROLS. This filter would then be invoked by the AlignmentToolbar instead of the referencing theBLOCK_ALIGNMENTS_CONTROLSobject.Describe alternatives you've considered
I think this functionality could also be handled by a registration model with a store, but that seems like a lot of extra work. I'm sure there are other options, but I'm not familiar enough with Gutenberg internals to suggest them.
Alternatively we can certainly solve this with a self-built version of Gutenberg, but we prefer to stay with the version distributed with WordPress releases if possible.