Skip to content

Block Library: Add missing transforms between Verse and Preformatted blocks #70101

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

Merged

Conversation

Sukhendu2002
Copy link
Contributor

@Sukhendu2002 Sukhendu2002 commented May 12, 2025

What?

Part of: #63635

Add missing block transforms between Verse and Preformatted blocks.

Why?

Currently, there's no way to transform between Verse and Preformatted blocks. Adding this transformation improves the editor experience.

Testing Instructions

  1. Add a Verse block to the editor and add some content
  2. Select the block and open the block converter
  3. Verify you can convert to a Preformatted block and the content is preserved
  4. Similarly, add a Preformatted block, add content, and verify you can convert it to a Verse block

Screenshots or screencast

Screen.Recording.2025-05-12.at.4.46.17.PM.mov

@Sukhendu2002 Sukhendu2002 marked this pull request as ready for review May 12, 2025 13:40
Copy link

github-actions bot commented May 12, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: Sukhendu2002 <sukhendu2002@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@t-hamano t-hamano added [Type] Enhancement A suggestion for improvement. [Feature] Block Transforms Block transforms from one block to another [Block] Verse Affects the Verse block [Block] Preformatted Affects the Preformatted Block - used for showing preformatted text labels May 13, 2025
Copy link
Contributor

@t-hamano t-hamano left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

This PR seems to contain duplicate transformations:

  • Verse block:
    • From: core/preformatted
    • To: core/preformatted
  • Preformatted block:
    • From: core/verse
    • To: core/verse

If you register just one transformation each as shown below, everything should work fine.

  • Preformatted block:
    • From: core/verse
    • To: core/verse

This means that we shouldn't need to change anything in the Verse block.

@Sukhendu2002
Copy link
Contributor Author

Thanks for pointing that out—sorry for the oversight. I’ve removed the duplicate transformation.

@Sukhendu2002 Sukhendu2002 requested a review from t-hamano May 21, 2025 10:12
@Sukhendu2002 Sukhendu2002 requested a review from t-hamano May 21, 2025 16:11
Copy link
Contributor

@t-hamano t-hamano left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@t-hamano t-hamano merged commit 80a371e into WordPress:trunk May 22, 2025
63 checks passed
@github-actions github-actions bot added this to the Gutenberg 20.9 milestone May 22, 2025
chriszarate pushed a commit to chriszarate/gutenberg that referenced this pull request Jul 1, 2025
…blocks (WordPress#70101)

* Add missing transforms between Verse and Preformatted block

* Revert test file changes

* Update test files

* Restart unit tests

* Restart unit tests

* Update test snapshots

* Remove duplicate transformations between Verse and Preformatted blocks

* refactor: simplify verse block transform

Co-authored-by: Sukhendu2002 <sukhendu2002@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Preformatted Affects the Preformatted Block - used for showing preformatted text [Block] Verse Affects the Verse block [Feature] Block Transforms Block transforms from one block to another [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants