-
Notifications
You must be signed in to change notification settings - Fork 6
Closed
Labels
bugSomething isn't workingSomething isn't working
Milestone
Description
Do you want to request a feature or report a bug?
Bug. See springload/draftail#179.
What is the current behavior?
Pasting a particular image formatting from Word, the content coming from the filters contains an image block that trips up the editor’s rendering.
Input document: draftail-crash-elon-musk-article.docx
Draft.js output on https://thibaudcolas.github.io/draftjs-filters/:
Without filters
{
"blocks": [
{
"key": "f8beh",
"text": " ",
"type": "unstyled",
"depth": 0,
"inlineStyleRanges": [],
"entityRanges": [],
"data": {}
},
{
"key": "35q1g",
"text": "Test",
"type": "unstyled",
"depth": 0,
"inlineStyleRanges": [],
"entityRanges": [],
"data": {}
},
{
"key": "82iof",
"text": "📷",
"type": "unstyled",
"depth": 0,
"inlineStyleRanges": [],
"entityRanges": [
{
"offset": 0,
"length": 1,
"key": 0
}
],
"data": {}
}
],
"entityMap": {
"0": {
"type": "IMAGE",
"mutability": "MUTABLE",
"data": {
"alt": "Image result for ross geller annulment",
"height": "226",
"src": "file://localhost/Users/thibaud/Library/Group%20Containers/UBF8T346G9.Office/msoclip1/01/clip_image002.png",
"width": "340"
}
}
}
}
With filters
{
"blocks": [
{
"key": "378gv",
"text": " ",
"type": "unstyled",
"depth": 0,
"inlineStyleRanges": [],
"entityRanges": [],
"data": {}
},
{
"key": "4h5in",
"text": "Test",
"type": "unstyled",
"depth": 0,
"inlineStyleRanges": [],
"entityRanges": [],
"data": {}
},
{
"key": "53d8u",
"text": " ",
"type": "atomic",
"depth": 0,
"inlineStyleRanges": [],
"entityRanges": [
{
"offset": 0,
"length": 1,
"key": 0
}
],
"data": {}
}
],
"entityMap": {
"0": {
"type": "IMAGE",
"mutability": "MUTABLE",
"data": {
"src": "file://localhost/Users/thibaud/Library/Group%20Containers/UBF8T346G9.Office/msoclip1/01/clip_image002.png"
}
}
}
}
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. GIFs and screenshots are very helpful too.
- Open the input document linked above with Word (might also work with other word processors).
- Copy the content around the image
- Paste in the editor
What is the expected behavior?
The editor shouldn't have to render problematic content. Either:
- The image block shouldn't be there if its
src
does not match the whitelist, and the selection should be placed on the last block of the paste. - The image block should be there, and should be
IMMUTABLE
, and should be followed by an empty block if needed to allow its selection (Filters should inject blocks before and afteratomic
blocks as required #14)
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working