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

Add Text Columns → Columns transform #9364

Merged
merged 2 commits into from Aug 27, 2018

Conversation

Projects
None yet
3 participants
@ZebulanStanphill
Contributor

ZebulanStanphill commented Aug 26, 2018

Description

This PR adds a one-way Text Columns → Columns transform to make it easier to migrate from the deprecated block. The alignment, custom CSS classes, and content are all preserved.

How has this been tested?

You can test this branch by copy-pasting this markup into a post and trying out the transforms on the Text Columns blocks:

<!-- wp:text-columns {"className":"yoyo"} -->
<div class="wp-block-text-columns alignundefined columns-2 yoyo"><div class="wp-block-column"><p>Content<br/>2nd line in same paragraph<br/><br/>4th line<br/></p></div><div class="wp-block-column"><p>More content</p></div></div>
<!-- /wp:text-columns -->

<!-- wp:text-columns {"width":"center","className":"donut"} -->
<div class="wp-block-text-columns aligncenter columns-2 donut"><div class="wp-block-column"><p>Content<br/>2nd line in same paragraph<br/><br/>4th line<br/></p></div><div class="wp-block-column"><p>More content</p></div></div>
<!-- /wp:text-columns -->

<!-- wp:text-columns {"width":"wide","className":"neato"} -->
<div class="wp-block-text-columns alignwide columns-2 neato"><div class="wp-block-column"><p>Content<br/>2nd line in same paragraph<br/><br/>4th line<br/></p></div><div class="wp-block-column"><p>More content</p></div></div>
<!-- /wp:text-columns -->

Additional notes

Ideally, you would want to automatically transform deprecated blocks into the recommended replacements, but the deprecated blocks API does not currently support migrating from/to a completely different block, so using the transforms API to allow for easy user-initiated transforms is currently the best option.

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.

Related issues and PRs

@chrisvanpatten

This comment has been minimized.

Show comment
Hide comment
@chrisvanpatten

chrisvanpatten Aug 26, 2018

Contributor

Ideally, you would want to automatically transform deprecated blocks into the recommended replacements, but the deprecated blocks API does not currently support migrating from/to a completely different block, so using the transforms API to allow for easy user-initiated transforms is currently the best option.

I don't want to derail this PR, but I'm super curious if this has been discussed in the past. This feels like a great opportunity to improve the deprecation experience.

Contributor

chrisvanpatten commented Aug 26, 2018

Ideally, you would want to automatically transform deprecated blocks into the recommended replacements, but the deprecated blocks API does not currently support migrating from/to a completely different block, so using the transforms API to allow for easy user-initiated transforms is currently the best option.

I don't want to derail this PR, but I'm super curious if this has been discussed in the past. This feels like a great opportunity to improve the deprecation experience.

@ZebulanStanphill

This comment has been minimized.

Show comment
Hide comment
@ZebulanStanphill

ZebulanStanphill Aug 27, 2018

Contributor

@chrisvanpatten If it has been discussed before, I don't know about it. 🤷‍♂️ I agree that it would be great to have that kind of functionality, and I'm also curious if it has been discussed before.

Contributor

ZebulanStanphill commented Aug 27, 2018

@chrisvanpatten If it has been discussed before, I don't know about it. 🤷‍♂️ I agree that it would be great to have that kind of functionality, and I'm also curious if it has been discussed before.

@ZebulanStanphill

This comment has been minimized.

Show comment
Hide comment
@ZebulanStanphill

ZebulanStanphill Aug 27, 2018

Contributor

@youknowriad Addressed feedback; the transform is now defined in text-columns/index.js.

Contributor

ZebulanStanphill commented Aug 27, 2018

@youknowriad Addressed feedback; the transform is now defined in text-columns/index.js.

@youknowriad

LGTM 👍 Thanks

@youknowriad youknowriad merged commit 349e892 into WordPress:master Aug 27, 2018

2 checks passed

codecov/project 50.58% (-0.01%) compared to c345f59
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@ZebulanStanphill ZebulanStanphill deleted the ZebulanStanphill:update/add-text-columns-to-columns-transform branch Aug 27, 2018

@ZebulanStanphill

This comment has been minimized.

Show comment
Hide comment
@ZebulanStanphill

ZebulanStanphill Aug 27, 2018

Contributor

@youknowriad This should be added to the 3.7 milestone.

Contributor

ZebulanStanphill commented Aug 27, 2018

@youknowriad This should be added to the 3.7 milestone.

@youknowriad youknowriad added this to the 3.7 milestone Aug 27, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment