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

Legacy Widget: Add "Convert to blocks" button #25100

Closed
noisysocks opened this issue Sep 7, 2020 · 13 comments · Fixed by #31215
Closed

Legacy Widget: Add "Convert to blocks" button #25100

noisysocks opened this issue Sep 7, 2020 · 13 comments · Fixed by #31215
Assignees
Labels
[Block] Legacy Widget Affects the Legacy Widget Block - used for displaying Classic Widgets [Block] Paragraph Affects the Paragraph Block [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@noisysocks
Copy link
Member

Split out from #15911.

It's not currently possible to transform a legacy Text widget into a Paragraph block.

Steps to reproduce:

  1. Navigate to /wp-admin/widgets.php by manually entering the URL into your browser.
  2. Add a Text widget to one of your widget areas, insert some text, and click Save.
  3. Go to Appearance → Widgets.
  4. Select the Legacy Widget block that corresponds to the Text widget that you just added.
  5. Click on the block icon in the block toolbar to open the Transform to menu.

Expected result:

An option to transform the widget into a Paragraph block should appear.

Actual result:

Screen Shot 2020-09-07 at 11 07 03

Only an option to transform the widget into a Group block appears.

@noisysocks noisysocks added [Type] Bug An existing feature does not function as intended [Block] Paragraph Affects the Paragraph Block [Block] Legacy Widget Affects the Legacy Widget Block - used for displaying Classic Widgets labels Sep 7, 2020
@maddisondesigns
Copy link

maddisondesigns commented Sep 7, 2020

As mentioned in that original issue that I created (#15911), it's not good enough to simply transform a legacy Text Widget into a Paragraph Block. In fact, it's impossible to do so.

A widget is more than just the main content, it's also a header, and in the case of a Text Widget, it may be one or more Paragraphs of content. Since you only allow 1 paragraph per Paragraph Block, it's simply not possible to convert a single legacy Text Widget into a single Paragraph Block. You would need to transform it into one Heading Block, and one or more Paragraph Blocks. It may even be better to transform it into a Heading Block and a Classic Block, that way you wouldn't need to split the content into multiple paragraph blocks.

Likewise with any of the existing widgets. You need one Heading Block, and some other block. You can't simply ignore, or forget about the headings in the legacy Widgets.

This is one of the items I also mentioned as well, in regards to this whole widgets UI. Having to add multiple blocks, just to replicate one widget in the classic Widgets screen, is making it a LOT harder for people to migrate to the new Widgets screen, and also makes it significantly harder to maintain going forward. I've now gone from 5 simple widgets, to a minimum of 10 blocks, and in some case, it could be 15 or 20 blocks. This is not making WordPress easier to manage for users.

@noisysocks
Copy link
Member Author

Thanks for flagging @maddisondesigns. Perhaps instead of adding a Paragraph transformation we need to add a Convert to blocks button similar to what the Classic block has.

@noisysocks
Copy link
Member Author

@mapk: Does adding Convert to blocks to the Legacy Widget block's toolbar when the widget is a Text widget make sense to you?

@noisysocks noisysocks added the Needs Design Needs design efforts. label Sep 7, 2020
@maddisondesigns
Copy link

@noisysocks Having a Convert to blocks button sounds like a really good idea 👍

@mapk
Copy link
Contributor

mapk commented Sep 9, 2020

@mapk: Does adding Convert to blocks to the Legacy Widget block's toolbar when the widget is a Text widget make sense to you?

Yes! I'd love a way to easily convert widgets (that can be) to blocks! In this way the Legacy Widget block aligns with the Classic block. Maybe the naming should also align? Classic Widget block ?

Let's also make sure that button doesn't show up unless it's possible to convert, right?

I would imagine it looking similar to this:

Text widget

@adamziel
Copy link
Contributor

adamziel commented Sep 18, 2020

Just to confirm @mapk @noisysocks - is this issue about adding "Convert to blocks" button to the "Legacy Widget block of type text widget"? Or to "all legacy widget blocks that are possible to transform to another block"? If it's the latter - it would be pretty much the same as the existing "Transform" dropdown, only more identifiable.

Thanks for flagging @maddisondesigns. Perhaps instead of adding a Paragraph transformation we need to add a Convert to blocks button similar to what the Classic block has.

I don't quite follow @noisysocks - would you mind elaborating? My thinking is that converting the widget to a heading and a paragraph block using a new kind of button would be essentially working around the limitations of transformations, no? If we add that button to one legacy widget, it would only make sense to add it to all other legacy widgets for consistency. Couldn't we just improve transformations and make the transform button more visible? Or convert it to a group of blocks?

@mapk
Copy link
Contributor

mapk commented Sep 18, 2020

@adamziel, the "Convert to blocks" button is a existing pattern used on the Classic block.

Classic block

Screen Shot 2020-09-18 at 9 42 05 AM

I believe the proposal here is to mimic this behavior for widgets that have a block equivalent and can easily be converted to blocks. It's different from a transform, IMO.

@adamziel
Copy link
Contributor

adamziel commented Sep 21, 2020

@mapk thank you for providing the classic block example! While I think I understand the idea, it feels a little confusing to me:

  • Having both "Transform to blocks" and "Convert to blocks" would be confusing.
  • Having some widgets that have "transform" button and some others that have "convert to blocks" would be confusing.
  • Having only "Convert to blocks" would be consistent, but would prevent plugin authors from providing their own transforms...
  • ...unless we make "convert to blocks" a dropdown and provide multiple options whenever they're available. But it seems to be the same as the existing "Transform to blocks". At a very least it would use the same transforms API.

I think we should just enhance transforms to support the missing use-case. Labeling the transform button to "Convert to blocks" could be a nice UX touch on the legacy block. I'd love to hear more opinions here too, cc @youknowriad @noisysocks @draganescu @talldan @tellthemachines

@adamziel
Copy link
Contributor

adamziel commented Sep 21, 2020

One more note - I imagine for most widgets "Convert to blocks" would apply the first available transform. Text widget is the one case we know about where it would do something different. Unless it's only enabled for the text widget? 🤔 I also imagine it should be extendable by plugin authors.

@draganescu
Copy link
Contributor

So the thing I see here is that transform should be available if the widget developer (including core) provided such a transform, where the legacy widget block is transformed to another proprietary bloc (say Astra address widgets to Astra address block).

A convert to blocks option would mean (to me at least) a generic attempt to convert the widget's rendered html to a series of blocks, like we do with the classic block conversion to blocks.

I am not sure this is entirely possible though as some widgets render with contextual information.

@mapk
Copy link
Contributor

mapk commented Sep 21, 2020

I believe @draganescu is correct here. A "Transform" is a 1:1 block transform – a block is transformed into another block. A "Convert" is converting non-blocks (could be many elements) into corresponding blocks. That's how I understand it. I'm fairly certain this same conversation must have come up about the Classic Editor block. I wonder if the reasoning for the decision to add a "Convert to blocks" button would be helpful here?

@noisysocks
Copy link
Member Author

Definitely agree that transform and convert are technically two different concepts. Whether they're treated as different concepts in the UI is another story.

How can we move this one specific issue forward? I think the simplest path is to add Convert to blocks to only the Text widget. This mirrors the behaviour of the Classic block.

@mapk mapk removed the Needs Design Needs design efforts. label Oct 20, 2020
@noisysocks
Copy link
Member Author

How can we move this one specific issue forward? I think the simplest path is to add Convert to blocks to only the Text widget. This mirrors the behaviour of the Classic block.

Let's start with this and iterate.

@noisysocks noisysocks added the Needs Design Feedback Needs general design feedback. label Apr 27, 2021
@noisysocks noisysocks changed the title Legacy Widget: Users should be able to transform a legacy Text widget into a Paragraph block Legacy Widget: Add "Convert to blocks" button Apr 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Legacy Widget Affects the Legacy Widget Block - used for displaying Classic Widgets [Block] Paragraph Affects the Paragraph Block [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants