bobbingwide / oik-blocks

WordPress 5.0 blocks for oik shortcodes
https://oik-plugins.com/oik-plugins/oik-blocks
GNU General Public License v3.0
1 stars 0 forks source link

Add `oik-block/blockstyles` block to display information about a block's styling #44

Open bobbingwide opened 3 years ago

bobbingwide commented 3 years ago

With Full Site Editing coming along soon, a block's CSS styling may be defined using theme.json and the block's block.json file. As I understand it, the theme can override the block's default styling by using theme.json And I imagine other code can override the block's styling during registration.

But how can you tell, in advance from the front end, how the block's settings and styling are defined?

The block.json file defines the default supports and the names of the style files for the block: editor and front end.

eg for the cover block

"supports": {
        "anchor": true,
        "align": true,
        "html": false,
        "spacing": {
            "padding": true
        },
        "color": {
            "__experimentalDuotone": "> .wp-block-cover__image-background, > .wp-block-cover__video-background",
            "text": false,
            "background": false
        }
    },
    "editorStyle": "wp-block-cover-editor",
    "style": "wp-block-cover"

There are sections in theme.json which define settings, which I believe are similar to supports, and others which define the styles. The settings may or may not trump the block's supports values and the styles define the allowed values for the theme.

Requirement

Proposed solution