List v2: copy list wrapper when copying list items#42860
Conversation
|
Size Change: +183 B (0%) Total Size: 1.26 MB
ℹ️ View Unchanged
|
draganescu
left a comment
There was a problem hiding this comment.
This tests great! Tried the instructions also cross editors (GDoc, Pages, Plaintext) and works as expected.
I like this meta info in the clipboard :)
|
I've found a couple of glitches with nested list (they can be looked at separately from this PR).
Gravacao.de.ecra.a.partir.de.15-08-2022.13.46.48.webm
Gravacao.de.ecra.a.partir.de.15-08-2022.13.47.11.webm |
Not sure what you'd expect here. The nested items are, well, nested to the item you're copying, so it seems appropriate? |
|
For the second item, it seems like the selection is wrong (based on the position of the toolbar). |
My expectation was that only the parent was copied. I can see why that happens (the nested are child of the item I selected) and it makes sense within the block editor interaction model (selects whole blocks). Though the behavior is different from what typical editors do (docs, office). |

What?
Currently when copying one or multiple list items (or all), they are copied with the list wrapper.
Why?
List items must be copied with a wrapper to be valid HTML.
Currently copied list items can't be pasted outside of lists.
How?
Signals to the copy handler that a wrapper block needs to be created by setting extra clipboard data.
Testing Instructions
Enable experimental list v2.
Create a list with list items. Select a single or a few list items. Copy them and paste them in an empty paragraph. What is pasted should be a list (including the correct attributes).
Screenshots or screencast