Skip to content

Image pasted from Word is not properly processed #27

@thibaudcolas

Description

@thibaudcolas

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.

  1. Open the input document linked above with Word (might also work with other word processors).
  2. Copy the content around the image
  3. Paste in the editor

What is the expected behavior?

The editor shouldn't have to render problematic content. Either:

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions