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

core/pullquote: mainColor is only used if className = "is-style-solid-color" and customTextColor is not used #25

Open
lagset opened this issue Sep 9, 2021 · 0 comments

Comments

@lagset
Copy link

lagset commented Sep 9, 2021

Description

When setting the the "Main Color" of a core/pullquote-block instance in the editor by choosing a color of the color palette the mainColor attribute provided by the restAPI is not populated as expected:

It is only used if className = "is-style-solid-color" and customTextColor is not used. Otherwise the attribute customMainColor is used and populated with the hex-value of the chosen palette color.

Since the information is provided by the customMainColor attribute this is not a severe problem, but still seems inconsisent.

Examples

Not as expected: restAPI result for a core/pullquote block with "Style" set to "Default" and "Main Color" set to a palette preset with the slug "primary":

show result
{
  "blockName": "core/pullquote",
  "attrs": {
    "customMainColor": "#00aaad",
    "className": "has-background is-style-default",
    "value": "<p>is-style-default</p><cite>main color by Block Color Palettes</cite>",
    "citation": "main color by Block Color Palettes",
    "mainColor": "",
    "textColor": "",
    "customTextColor": "",
    "align": "",
    "anchor": ""
  },

As expected: restAPI result for a core/pullquote block with "Style" set to "Solid Color" and "Main Color" set to a palette preset with the slug primary:

show result
{
  "blockName": "core/pullquote",
  "attrs": {
    "mainColor": "primary",
    "className": "has-background is-style-solid-color",
    "value": "<p>is-style-solid-color</p><cite>main color by Block Color Palettes</cite>",
    "citation": "main color by Block Color Palettes",
    "customMainColor": "",
    "textColor": "",
    "customTextColor": "",
    "align": "",
    "anchor": ""
  },

As expected: restAPI result for a core/pullquote block with "Style" set to "Solid Color", "Main Color" set to a palette preset with the slug "primary" and "Text Color" set to a palette preset with the slug secondary:

show result
{
  "blockName": "core/pullquote",
  "attrs": {
    "mainColor": "primary",
    "textColor": "secondary",
    "className": "has-background is-style-solid-color",
    "value": "<p>is-style-solid-color</p><cite>main color and text color by Block Color Palettes</cite>",
    "citation": "main color and text color by Block Color Palettes",
    "customMainColor": "",
    "customTextColor": "",
    "align": "",
    "anchor": ""
},

Not as expected: restAPI result for a core/pullquote block with "Style" set to "Solid Color", "Main Color" set to a palette preset with the slug "primary" and "Text Color" set to a custom color with the hex code #0008ff:

show result
{
  "blockName": "core/pullquote",
  "attrs": {
    "customMainColor": "#00aaad",
    "customTextColor": "#0008ff",
    "className": "has-background is-style-solid-color",
    "value": "<p>is-style-solid-color</p><cite>main color by Block COlor Palettes and text Color Custom</cite>",
    "citation": "main color by Block COlor Palettes and text Color Custom",
    "mainColor": "",
    "textColor": "",
    "align": "",
    "anchor": ""
  },

Expected Behaviour

When setting the "Main Color" of a core/pullquote-block instance in the editor by choosing a color of the color palette, the attribute mainColor should be populated with the slug of the chosen palette color, no matter which other attributes are set for the block instance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant