gutenberg icon indicating copy to clipboard operation
gutenberg copied to clipboard

Introduce a blacklist/whitelist for which blocks can be inserted into a column width

Open paulwilde opened this issue 8 years ago • 3 comments

With the introduction of nested blocks (#3745) one concern is that certain blocks might not be designed to work with certain column widths. An example would be that the Cover Image block is mainly designed as a full width block, but not to go inside a 1/6 column.

Allowing any block to go into any particular column width adds an additional burden on developers to ensure their block works correctly with all column widths, which in some cases is impossible. It adds control to ensure the client of a website you've developed for doesn't try and fit a square peg into a round hole.

One idea of implementation would be to introduce a new block configuration key maybe something like columns where if not defined, it's assumed the block works in any column width. Setting a value of [1, 2] would mean the block can be placed in either a 1/1 or 1/2 column, but not a 3-6 width column.

When you open up the block selector to add blocks to a column, either blocks which aren't compatible with that column width should either be greyed out or not shown at all. Not showing them at all probably the better solution.

paulwilde avatar Feb 06 '18 21:02 paulwilde

I think this is would be an application of child blocks: #5540

westonruter avatar Apr 17 '18 16:04 westonruter

Also related to this closed issue: #1654

jasonbahl avatar Apr 17 '18 16:04 jasonbahl

InnerBlocks allows specifying which blocks are allowed. A generic mechanism for opting in to columns doesn't make a lot of sense to me because the column container itself can be at different widths or values.

What makes more sense down the road is for InnerBlocks to define which "block width" alignments should be available within it.

mtias avatar Oct 07 '18 16:10 mtias