-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Description
Description
So there's been a bunch of stuff around splitting and attribute roles and whatnot, and a strange interaction led me to rip through the entire paste process to understand why a default block of ours was converting a pasted list into more of itself, only when the RichText input was focused.
The root cause is a line in
| if ( isUnmodifiedDefaultBlock( blockA ) ) { |
This gets further compounded by whether the blocks in question have transforms to or from each other. If the block is considered modified, and the blocks have valid transforms to/from, then the selected block isn't just split - the blocks being pasted in are converted as well.
I guess I'm coming at this from a view of, for example, user changes the text colour on a paragraph block and then, without anything else in the paragraph at all but with the focus inside it, pastes in an HTML list.
The result is the list items converted to paragraphs, but with the top and bottom lines using the colour.
As you can see, its kinda weird!
There's a couple ways this could be interpreted:
- The block had no content, so it should have been replaced with a list.
- with an optional "should the list also be pink", because the user did do something here. there's just nothing to split, so why use split logic?
- The user made a conscious change, so they probably want it to be a paragraph. In which case, why aren't all the lines pink?
And probably more besides, but that's what I'm stuck on.
Step-by-step reproduction instructions
- blank post
- copy an HTML list
- in the default paragraph block, change text colour to pink.
- then, with the paragraph block selected and the cursor blinky blinky, paste.
- see that list items are all converted to paragraphs, but only the first and last block have a pink colour.
Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
- Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
- Yes
Please confirm which theme type you used for testing.
- Block
- Classic
- Hybrid (e.g. classic with theme.json)
- Not sure
