-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adjust alignment-toolbar so that we disable the left, middle & right alignment options as needed #5195
Comments
Ther's a prop "controls" you can use to do that
|
It is also available to specify the list of alignment controls when registering your block as described here: https://github.com/WordPress/gutenberg/blob/a3ceee55afbe0200a1567945e14de6f3b3f14f61/docs/block-api.md#supports-optional. This update to documentation should land in the master together with the changes included in #5099. registerBlockType( 'my-block', {
supports: {
align: [ 'left' ],
},
// ... rest of your definitions
} ); If you use this option you don't need to manually include |
Ah great maybe we should add that to the docs under that component? I
would be happy to help.
…On 22 Feb 2018 17:42, "Riad Benguella" ***@***.***> wrote:
Ther's a prop "controls" you can use to do that
<BlockAligmnentToolbar controls={['left']} />
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#5195 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/APWFYakCoYjcMqcSDl7X8K7RzokGqf4Rks5tXRpNgaJpZM4SOvHS>
.
|
Good idea to include it there, too. If you would open a PR, that would be awesome 👍 |
Cheers will do this weekend :) |
Issue Overview
There will be blocks which will only require the full/wide width options and wouldnt need the left, right, centre alignment options. For example I have made a 'section' block which wraps other blocks similar to rows in page builder plugins.
It looks like the alignment options are constants in the block-alignment component:
const ALIGNMENT_CONTROLS = [ { icon: 'editor-alignleft', title: __( 'Align left' ), align: 'left', }, { icon: 'editor-aligncenter', title: __( 'Align center' ), align: 'center', }, { icon: 'editor-alignright', title: __( 'Align right' ), align: 'right', }, ];
Possible Solution
It would be cool if when defining the you could specifiy which alignment constants could shown. Something like:
``
<BlockAligmnentToolbar allowedControls = array['left'] />
``
I am happy to help with expanding the documentation on this feature.
The text was updated successfully, but these errors were encountered: