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

Transform paragraph block to buttons block #28508

Open
wants to merge 3 commits into
base: master
from

Conversation

@hsingyuc
Copy link
Contributor

@hsingyuc hsingyuc commented Jan 27, 2021

Description

Fix #28298
Transform paragraph block to buttons block

How has this been tested?

// Test text with one link

  1. Create text ( ex. Link in Paragraph ) with a link in a paragraph block
  2. Mark Link in Paragraph, click Change block type or style and see if Buttons renders as expected.
  3. Click Buttons and see if the text transforms into a button with the link.

// Test texts with links

  1. Create text ( ex. Link in Paragraph ) with links ( ex. link1 link2 link3 ) in a paragraph block
  2. Mark Link in Paragraph, click Change block type or style and see if Buttons renders as expected.
  3. Click Buttons and see if the text transforms into a button with the first link (link1).

// Test texts without a link

  1. Create text ( ex. Link in Paragraph ) without a link in a paragraph block
  2. Mark Link in Paragraph, click Change block type or style and see if Buttons renders as expected.
  3. Click Buttons and see if the text transforms into a button.

Screenshots

  1. Before

before

paragraph

  1. After

after

button

Types of changes

Checklist:

  • [X ] My code is tested.
  • My code follows the WordPress code style.
@hsingyuc hsingyuc requested a review from ajitbohra as a code owner Jan 27, 2021
@mtias
Copy link
Contributor

@mtias mtias commented Jan 27, 2021

Side note: one thing we need to revise a bit is the order of transformations. Headings and List should probably come first, for example. We might also want to restrict certain transforms to the case where the length of a paragraph block is < than some characters — it doesn't make sense to convert a full paragraph with multiple lines into a button, for example.

@ntsekouras
Copy link
Contributor

@ntsekouras ntsekouras commented Jan 27, 2021

We might also want to restrict certain transforms

Maybe also checking if a paragraph has more than one links?

@hsingyuc
Copy link
Contributor Author

@hsingyuc hsingyuc commented Jan 27, 2021

Headings and List should probably come first

It renders based on the usage so I think this is the current expected behavior. If we want to change, this may be a follow-up issue.
螢幕快照 2021-01-27 下午5 08 11

We might also want to restrict certain transforms to the case where the length of a paragraph block is < than some characters

I didn't know there was a way to do this. Any suggestions on checking length before showing the transform option in the transforms list?

Maybe also checking if a paragraph has more than one links?

Do you mean if more than one link then it transforms to multiple buttons or if more than a link then do not transform?

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

Successfully merging this pull request may close these issues.

3 participants