Skip to content

Unknown styles crash the editor #13

@bramski

Description

@bramski

Some of the draftjs editors generate super weird styles:

{
  "blocks": [
    {
      "data": {
      },
      "depth": 0,
      "entityRanges": [
      ],
      "inlineStyleRanges": [
        {
          "length": 118,
          "offset": 0,
          "style": "color-rgba(0,0,0,0.87)"
        },
        {
          "length": 118,
          "offset": 0,
          "style": "bgcolor-rgb(255,255,255)"
        },
        {
          "length": 118,
          "offset": 0,
          "style": "fontsize-14"
        },
        {
          "length": 118,
          "offset": 0,
          "style": "fontfamily-sans-serif"
        }
      ],
      "key": "2c9et",
      "text": "Hi John!\n\nThanks for your question.  We're looking forward to seeing you on the trip.  Crampons are great.  Pray for ⛷",
      "type": "unstyled"
    }
  ],
  "entityMap": {
  }
}

Currently this sort of data is really difficult to deal with. This is from draft-js-wysiwyg someone copy pasting the data in. Would be nice to just ignore these unknown styles and perhaps not display them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions