WordPress / theme-experiments

Experimenting with themes made out of blocks.
GNU General Public License v2.0
549 stars 183 forks source link

TT1 blocks: Enable margin support in theme.json for 10.7 #260

Open carolinan opened 3 years ago

carolinan commented 3 years ago

This is more of a heads up that we can start working on adding support for margins via theme.json for Gutenberg 10.7.

bobbingwide commented 3 years ago

Can you add a hint to how this can be done? eg an extract from theme.json

pbking commented 3 years ago

There is some information regarding theme.json support here. Specifically customMargin must be enabled via theme.json (it defaults to false). Once that is done in the same way that 'padding' can be added to block style configuration so too can margin. e.g.:

    "core/group": {
        "spacing": {
            "margin": {
                "top": "10px",
...

Not all blocks support user-controlled margins (not many at this point). I haven't explored this much but most (all?) blocks SHOULD have the ability to have margins configured via theme.json - user support configured via block.json or not. But I have not confirmed this.

MaggieCabrera commented 2 years ago

Is there anything we need to do about this?

carolinan commented 2 years ago

Theme.json already includes "appearanceTools": true, but we need version 2 for it to work. I set it to 2 in #307.