admin管理员组

文章数量:1130349

I'm trying to create a full width blocks for the new Gutenberg editor, however I don't want to give to option to toggle the block alignment (eg: like the Cover block does) just make it full width all the time.

I managed to add support for this with the supports flag in my block:

supports: {
    align: ['full']
}

attributes: {
    align: {
        type: 'string',
        default: 'full'
    }
}

This shows the block in the admin area as full width by default but it also displays the Block Alignment Toolbar at the top so it can be toggled on/off:

Is there a way to set the block alignment without displaying the toolbar?

I'm trying to create a full width blocks for the new Gutenberg editor, however I don't want to give to option to toggle the block alignment (eg: like the Cover block does) just make it full width all the time.

I managed to add support for this with the supports flag in my block:

supports: {
    align: ['full']
}

attributes: {
    align: {
        type: 'string',
        default: 'full'
    }
}

This shows the block in the admin area as full width by default but it also displays the Block Alignment Toolbar at the top so it can be toggled on/off:

Is there a way to set the block alignment without displaying the toolbar?

本文标签: editorHow to display full width block without toolbar