WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.34k stars 4.13k forks source link

Audit block transforms #63635

Open ellatrix opened 2 months ago

ellatrix commented 2 months ago

Let's audit:

Existing

Missing

Cc @richtabor maybe you have a good sense of what else is missing.

cbirdsong commented 2 months ago

I couldn't find an existing issue for this, but a paragraph block containing only an inline image should be able to be transformed into an image block.

ellatrix commented 2 months ago

Sure, we can add that

richtabor commented 2 months ago

General notes

Does SINGLE paragraph => columns make sense?

I think it's strange to promote transforming to columns, unless I have multi-selected blocks. Otherwise I just place the current block in one column, which is not quite as meaningful (and perhaps disorienting).

Maybe we need two "transform" categories: transform and wrap.

I'm not bullish on transforming to "Group" from the transform panel. It's great in the block options, as it's an action I'm taking, rather than a true transforming of the current block. We're mixing the ideas a bit including transform to group in the transforms panel.

I don't think we need two groups. I'm not sure that wrapping to anything other than group is super helpful in the editing flow (other than the case of multi-select with columns).

Transform priority

The notion of transform priority is an important one. I know we have a few in there, but it would be great if we could set prioritized transforms—especially for generic content blocks—like the image block to prioritize gallery and cover for example (and review the current prioritized transforms).

Apart from the list you made, just making Columns multi-select only, and removing "Group" as an ever-present transform (relying on the block options group functionality makes the transform panel much more intentional. Then with just a few prioritized transforms for content and images, I think it'll be super solid.

richtabor commented 2 months ago

Image & Text => video does not make sense?

Agreed

Heading => list does not make sense? List => heading does not make sense either.

Yea, probably doesn't make much sense. Perhaps if you have multiple content blocks selected, you can transform to List.

Does paragraph <> code make sense? Also maybe remove Preformatted?

I can see these being ok perhaps. It's likely confusing for many users to see "Peformatted" though

Multiple => Headings does not make sense?

It's probably fine.

annezazu commented 1 month ago

Putting out there to include a way to transform between List types if possible while I know this broader issue to allow more control ideally would need to be done: https://github.com/WordPress/gutenberg/issues/51480

For now, there's not a way to transform between ordered and unordered items (you can select the parent list and change but still, it's an extra step):

https://github.com/user-attachments/assets/2361f944-d0af-46ab-9856-bd41567ce3db

Happy to open a specific issue for this but it felt on the edge to me.

ellatrix commented 1 month ago

@annezazu Yes, it's a general problem with list item transforms. I was also trying to convert a list to paragraphs and couldn't after selecting multiple list items. I wonder how we could best solve this. Technically, the list items are selected, not the whole list, so no transforms match (even if we add them, you can't insert paragraphs into a list block).

Anyone who cares about list that is good to ping? I think @jasmussen cares about lists and transforms 🙂

jasmussen commented 1 month ago

Well, specifically for lists, I'm not sure transforms is the best interface at all. It's a list block, it's not an ordered list block with a unordered list block to transform into.

To that end, I'd think this is rather a challenge with the block toolbar itself, which for the List specifically could benefit from showing some of the parent properties.

There's something we could try; it might need refinement, but it still seems made for this. For the Buttons block, we have a feature to absorb into the child block the controls for the parent block. Not here how the justification controls are available regardless of which "layer" I've chosen:

buttons

This is not yet applied to the list block:

list

But it seems worth trying. The only downside, the list block toolbar could get pretty long. Mockup:

List block with absorbed control