{
"name": "my/custom-block",
"attributes": {
"align": {
"type": "string"
},
"dropCap": {
"type": "boolean",
"default": false
},
"backgroundColor": {
"type": "string"
},
"foregroundColor": {
"type": "string"
},
"style": {
"type": 'object',
"default": {
"color": {
"background": "value",
"gradient": "value",
"text": "default value"
}
}
}
},
"usesContext": [
"backgroundColor",
"foregroundColor"
],
"supports": {
"align": [ "wide", "full" ],
"anchor": true,
"html": false,
"inserter": true,
"color": {
"__experimentalSkipSerialization": true,
"gradients": true,
"linkColor": true,
},
"fontSize": true,
"__experimentalFontStyle": true,
"__experimentalFontWeight": true,
"__experimentalTextTransform": true,
"__experimentalFontFamily": true,
"__experimentalTextDecoration": true
"__experimentalSelector": {
"my/custom-block/1": {
"selector": "h1",
"title": "h1",
"attributes": {
"level": 1
}
},
"my/custom-block/2": {
"selector": "h2",
"title": "h2",
"attributes": {
"level": 2
}
},
}
}
A block declaration is made of a few things, including
attributes,usesContext, andsupports.Take the following as a potential example:
See that the block:
alignneed to be set on both attributes and supports.backgroundColorandforegroundColor). See example Social Links Block: Add icon and background color options #25372