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 #30834

Conversation

ramonjd
Copy link
Member

@ramonjd ramonjd commented Apr 14, 2021

Description

This PR builds on top of #30124, which adds border, color and style block supports.

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

Part of #28913

⚠️ #30124 must land before this PR.

cc @aaronrobertshaw

❓ A future iteration could see us also removing the block's styles and adding appropriate deprecations. Given that we can now achieve border and background variations using block supports, if we allowed text alignment of both the blockquote and citation elements, I believe the block's styles would become redundant.

How has this been tested?

Manually, in the editor.

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-14 at 10 04 38 pm

Types of changes

This is a non-breaking change that adds experimental border and color block support to the pullquote block.

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.

We've also added a deprecation (v4).

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • I've tested my changes with keyboard and screen readers.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR (please manually search all *.native.js files for terms that need renaming or removal).

aaronrobertshaw and others added 18 commits March 25, 2021 14:06
Passing these props prevents the need for the ColorGradientControl to retrieve the colors a second time.
…nto add/block-support-to-pullquote

# Conflicts:
#	lib/experimental-default-theme.json
#	packages/block-editor/src/hooks/border-color.js
Adding some TODOs for later cleanups
@oandregal
Copy link
Member

This PR is doing two things: add support for border properties that depends on #30124 + remove the block color handling in favor of the hook. Can we split it up in two separate PR so it's easier to review and so quicker to land?

@ramonjd
Copy link
Member Author

ramonjd commented Apr 15, 2021

This PR is doing two things: add support for border properties that depends on #30124 + remove the block color handling in favor of the hook. Can we split it up in two separate PR so it's easier to review and so quicker to land?

Thanks, I appreciate the quick feedback @nosolosw 🙇

I agree with you, nevertheless 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.

pullquote-hilarity

It sets a single attribute for Main color, so replacing that with controls whose label communicates "Background color" only would be confusing UX.

It would be convenient to replace the block controls with the colours hook, if we could also edit the background label.

It would still require some refactoring and a new deprecation.

An alternative would be to add block supports for colour using the hook, and then manually add border controls to the InspectorControls.

That would, however, also demand a refactor of the current mainColor logic, as well as an addition of new a deprecation. Not to mention all of this again when we decide to add border supports.

In my view I don't think we'd make things any easier for reviewers or users of the block if we were to undergo such staged changes.

Here we have the opportunity to clean things up by a fantastic amount.

It's very likely that I'm missing something however 😄 so I'd welcome ideas if folks have a smoother path towards converting pullquote to use block supports.

Thank you!!

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.

This is testing well for me 👍

Old versions of the pullquote block with colors are being successfully migrated.

Use of the block supports here really does clean up the block's code as well as provide enhanced functionality to the user. Looks good ✨

There are a few minor things that might be worth tidying up. The first is only turning on the custom border supports for the pullquote block's context rather than all blocks.

The second is the "Solid Color" block style. It still feels like that should be renamed given it doesn't affect colors at all now. Obviously, maintaining the block style CSS class for backwards compatibility might be an issue. I'm interested to hear what others think is the best approach here.

lib/experimental-default-theme.json Outdated Show resolved Hide resolved
ramonjd and others added 3 commits April 15, 2021 11:34
This was for testing purposes only and shouldn't have been committed.
@ramonjd ramonjd changed the title [WIP] Pullquote: add block support Pullquote: add block support Apr 16, 2021
@aaronrobertshaw aaronrobertshaw deleted the branch WordPress:update/border-block-support April 19, 2021 03:50
@ramonjd ramonjd deleted the add/block-support-to-pullquote branch April 19, 2021 04:46
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

Successfully merging this pull request may close these issues.

3 participants