Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc: Fix description and documentation for link color support #46405

Merged
merged 1 commit into from
Dec 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 10 additions & 21 deletions docs/reference-guides/block-api/block-supports.md
Original file line number Diff line number Diff line change
Expand Up @@ -351,36 +351,25 @@ supports: {
Link color presets are sourced from the `editor-color-palette` [theme support](/docs/how-to-guides/themes/theme-support.md#block-color-palettes).


When the block declares support for `color.link`, the attributes definition is extended to include two new attributes: `linkColor` and `style`:

- `linkColor`: attribute of `string` type with no default assigned.

When a user chooses from the list of preset link colors, the preset slug is stored in the `linkColor` attribute.

The block can apply a default preset text color by specifying its own attribute with a default e.g.:

```js
attributes: {
linkColor: {
type: 'string',
default: 'some-preset-link-color-slug',
}
}
```
When the block declares support for `color.link`, the attributes definition is extended to include the `style` attribute:

- `style`: attribute of `object` type with no default assigned.

When a custom link color is selected (i.e. using the custom color picker), the custom color value is stored in the `style.color.link` attribute.
When a link color is selected, the color value is stored in the `style.elements.link.color.text` attribute.

The block can apply a default custom link color by specifying its own attribute with a default e.g.:
The block can apply a default link color by specifying its own attribute with a default e.g.:

```js
attributes: {
style: {
type: 'object',
default: {
color: {
link: '#ff0000',
elements: {
link: {
color: {
text: '#ff0000',
}
}
}
}
}
Expand Down Expand Up @@ -583,7 +572,7 @@ attributes: {
}
```

A spacing property may define an array of allowable sides – 'top', 'right', 'bottom', 'left' – that can be configured. When such arbitrary sides are defined, only UI controls for those sides are displayed.
A spacing property may define an array of allowable sides – 'top', 'right', 'bottom', 'left' – that can be configured. When such arbitrary sides are defined, only UI controls for those sides are displayed.

Axial sides are defined with the `vertical` and `horizontal` terms, and display a single UI control for each axial pair (for example, `vertical` controls both the top and bottom sides). A spacing property may support arbitrary individual sides **or** axial sides, but not a mix of both.

Expand Down
2 changes: 1 addition & 1 deletion schemas/json/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@
},
"link": {
"type": "boolean",
"description": "This property adds block controls which allow the user to set link color in a block, link color is disabled by default.\n\nLink color presets are sourced from the editor-color-palette theme support.\n\nWhen the block declares support for color.link, the attributes definition is extended to include two new attributes: linkColor and style",
"description": "This property adds block controls which allow the user to set link color in a block, link color is disabled by default.\n\nLink color presets are sourced from the editor-color-palette theme support.\n\nWhen the block declares support for color.link, the attributes definition is extended to include the style attribute",
"default": false
},
"text": {
Expand Down