codex-team / codex-team/editor.js
Paste: new block is created instead of inline-pasting
- Dominant language
- TypeScript
- Stars
- 31.9k
- Forks
- 2.2k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 1
Description
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 `
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).
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",
"Test3ULGD
",
"Test3ULGD
",
"
"
]
}
},
{
"id": "yyGjDcyCFp",
"type": "list",
"data": {
"style": "ordered",
"items": [
"Test3ULGD"
]
}
},
{
"id": "Ujzmbf6XIX",
"type": "list",
"data": {
"style": "ordered",
"items": [
"Test3ULGD"
]
}
}
],
"version": "2.24.3"
}`
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.