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

Pullquote: add block support #30951

Merged

Conversation

ramonjd
Copy link
Member

@ramonjd ramonjd commented Apr 19, 2021

Description

In this PR, we're adding border and color block support to the Pullquote block.

Given that we can now achieve border and background variations using block supports, we're removing the existing styles and adding a textAlign attribute to compensate.

Furthermore, because the new block supports already offers the controls we need to style the Pullquote, the current controls are not required. We have therefore removed those and also the styles/border/classes logic.

ℹ️ There was some discussion about whether this PR could be split into two: adding first border support, then color support in a later PR. I believe this block is a special case because, at present, the background colour control determines both the border colour and background colour, depending on which block style we select.

How has this been tested?

Manually, in the editor (web and mobile device)

Because this PR deprecates the current version of Pullquote, we've updated the fixtures (version 4 is the last previous version).

Check that fixtures are valid:

npm run fixtures:regenerate test/integration/full-content/full-content.test.js

And by pasting current fixture block code into the editor and making sure a valid transform takes place.

Check in a native mobile device that the block works as intended.

Screenshots

Screen Shot 2021-04-27 at 4 33 11 pm

Types of changes

These changes add experimental border and color block support to the Pullquote block.

The attributes are changing, hence we've added a deprecation (v4).

Block support controls supersede the block's original controls, so we have removed them. So too, there's now no longer any need to differentiate between the usage of mainColor for background and border, since we can control each independently.

Part of #28913

cc @aaronrobertshaw

@ramonjd ramonjd force-pushed the add/pullquote-block-border-color-support branch 3 times, most recently from 4b873c9 to a1acc07 Compare April 19, 2021 05:39
@ockham
Copy link
Contributor

ockham commented Apr 19, 2021

This might not be specific to this block, but if I set a border color, width, and radius, and leave the border style as 'Default', I see something like this:

image

That looks a bit off. If I change the border style to 'Solid', it looks right:

image

@ramonjd ramonjd force-pushed the add/pullquote-block-border-color-support branch 3 times, most recently from 54636e6 to 42aeddc Compare April 20, 2021 05:13
@ramonjd
Copy link
Member Author

ramonjd commented Apr 20, 2021

This might not be specific to this block, but if I set a border color, width, and radius, and leave the border style as 'Default', I see something like this:

It's the style variant CSS driving this I think. It's my opinion that we can remove the style variations in the next iteration as mention in the description.

@aaronrobertshaw
Copy link
Contributor

This might not be specific to this block, but if I set a border color, width, and radius, and leave the border style as 'Default', I see something like this:

It's the style variant CSS driving this I think. It's my opinion that we can remove the style variations in the next iteration as mention in the description.

I believe this is a theme issue. The theme sets a solid border style for the top and bottom borders. The "Solid color" block style has more specific CSS that sets border: none.

Screen Shot 2021-04-20 at 4 39 38 pm

@ramonjd ramonjd force-pushed the add/pullquote-block-border-color-support branch 2 times, most recently from 5b95058 to e81d100 Compare April 21, 2021 05:35
@ramonjd
Copy link
Member Author

ramonjd commented Jul 12, 2021

@ramonjd Can you replicate the duplicate panel issue?

Thanks for the ping. I've just rebased the branch and have started retesting.

quote-example-after-rebase.mp4

I haven't come across the double color panel conundrum yet.

@aaronrobertshaw aaronrobertshaw self-requested a review July 19, 2021 06:33
Copy link
Contributor

@aaronrobertshaw aaronrobertshaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've given this another test after the latest rebase. Everything works as advertised for me.

Still no sign of a duplicate color panel. I'm comfortable saying that was a one-off in Joen's local environment.

There are also a couple of e2e failures still. Re-running the tests didn't get them passing. The failures do appear unrelated to this PR so once they pass we should be right to merge.

Thanks for all the hard work on this @ramonjd 👍

@ramonjd
Copy link
Member Author

ramonjd commented Jul 19, 2021

There are also a couple of e2e failures still. Re-running the tests didn't get them passing. The failures do appear unrelated to this PR so once they pass we should be right to merge.

Thanks a lot for the final check @aaronrobertshaw !

Looks like some of the fixtures are now failing 🤷 Maybe that's the cause of the E2E failures. I'll rebase and 🤞

@ramonjd ramonjd force-pushed the add/pullquote-block-border-color-support branch from 7aa5427 to 888e6f3 Compare July 20, 2021 00:04
@ramonjd
Copy link
Member Author

ramonjd commented Jul 20, 2021

Merged changes from #33502 which move block e2e fixtures

@ramonjd ramonjd force-pushed the add/pullquote-block-border-color-support branch 2 times, most recently from d8ca82c to dfe8544 Compare July 20, 2021 03:51
Adding some TODOs for later cleanups
…ustom colors in the deprecation and newer versions.

Removing hanging empty blocks in parsed JSON
save: to make blockquote class assignment more consistent with figure class assignment
migrate: to make customMainColor/style logic neater and clearer

Remove state wrapper around pullquote export
Rebuilding fixtures with the (for now) expected hanging block in parsed.json files. We could trim them in `getBlockFixtureHTML`
…or deprecation v3 where there is no solid style, a mainColor attribute and an existing inline border style on the figure.

Regnerated fixtures.

Removing textColor from block attributes as they're adding by supports hooks
…unction require it, are returning the required attributes for the latest version.
… the default and solid block styles were, aside from the text alignment, redundant. So we have removed them.

To compensate for the alignment, this commit adds a text alignment block control.
Deprecated blocks will still have the `is-style-solid-class`, so we keep the styles targeting it, and also ensure that we set the new attribute `textAlign` to "left" when it's present.

Add specificity to the left and right text align styles so that the block alignment controls have a great chance of overriding theme styles.
All we needed to do was add `__deprecated` to the file name so that the fixture test regex could find it :)
@ramonjd ramonjd force-pushed the add/pullquote-block-border-color-support branch from dfe8544 to db08851 Compare July 20, 2021 06:39
@ramonjd ramonjd added this to the Gutenberg 11.2 milestone Jul 20, 2021
@ramonjd ramonjd merged commit ff0f6d3 into WordPress:trunk Jul 20, 2021
@ramonjd ramonjd deleted the add/pullquote-block-border-color-support branch July 20, 2021 23:49
sarayourfriend pushed a commit that referenced this pull request Jul 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Pullquote Affects the Pullquote Block [Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants