You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've run into some odd behavior around pasting items in a list. I'd love to get some insight if this is intentional, or perhaps a bug.
When copying a list item from a list block in the editor, the <li> element is copied to the clipboard. When pasting an <li> element, it triggers the creation of a new list block, regardless of the location of the caret. If the caret was placed in an existing list node, I would expect the pasted content to appear there.
In addition, if I've copied and pasted multiple list items from my clipboard, I would expect the first item to paste as text and fill the list node where the caret was placed, and the rest of the list items to be pasted as new list nodes.
Compared to other text editors/word processors these quirks did not present themselves. In an effort to rectify this, I started down the path of creating a new block tool which inherits the List class, and overriding the pasteHandler with custom logic that is aware of the caret's location.
There is also an issue in regards to undo. If I attempt to undo a pasted list, it won't work and will revert the steps made before pasting. Undo doesn't seem to "see" the list in the chain of user action history.
I've attached some GIFs and JSON below for a visual reference. The JSON shows items that have been pasted from a list created in Google Docs, which keeps any formatting intact (bold in this case).
I've run into some odd behavior around pasting items in a list. I'd love to get some insight if this is intentional, or perhaps a bug.
When copying a list item from a list block in the editor, the
<li>
element is copied to the clipboard. When pasting an<li>
element, it triggers the creation of a new list block, regardless of the location of the caret. If the caret was placed in an existing list node, I would expect the pasted content to appear there.In addition, if I've copied and pasted multiple list items from my clipboard, I would expect the first item to paste as text and fill the list node where the caret was placed, and the rest of the list items to be pasted as new list nodes.
Compared to other text editors/word processors these quirks did not present themselves. In an effort to rectify this, I started down the path of creating a new block tool which inherits the
List
class, and overriding thepasteHandler
with custom logic that is aware of the caret's location.There is also an issue in regards to undo. If I attempt to undo a pasted list, it won't work and will revert the steps made before pasting. Undo doesn't seem to "see" the list in the chain of user action history.
I've attached some GIFs and JSON below for a visual reference. The JSON shows items that have been pasted from a list created in Google Docs, which keeps any formatting intact (bold in this case).
Browsers: Firefox, Chrome, & Safari
@editorjs/editorjs: 2.25.0
@editorjs/list: 1.7.0
Expected Behavior
Unexpected Behavior
JSON
{ "time": 1663606028518, "blocks": [ { "id": "dSo3v4P9w3", "type": "list", "data": { "style": "ordered", "items": [ "test1", "test2", "test3", "<b>Test3ULGD</b><br>", "<b><b>Test3ULGD</b><br></b>", "<b><b><br></b></b>" ] } }, { "id": "yyGjDcyCFp", "type": "list", "data": { "style": "ordered", "items": [ "<b><b>Test3ULGD</b></b>" ] } }, { "id": "Ujzmbf6XIX", "type": "list", "data": { "style": "ordered", "items": [ "<b><b>Test3ULGD</b></b>" ] } } ], "version": "2.24.3" }
The text was updated successfully, but these errors were encountered: