ignitionworks / draftjs_exporter

Export Draft.js content state into HTML.
MIT License
16 stars 20 forks source link

Unknown styles crash the editor #13

Closed bramski closed 6 years ago

bramski commented 6 years ago

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.

chrise86 commented 5 years ago

@theozaurus was this resolved or just closed due to inactivity?

theozaurus commented 5 years ago

I think @bramski has addressed the problem here: https://github.com/ignitionworks/draftjs_exporter/pull/14. I'm not actively maintaining this gem any longer as I do no work with DraftJS any longer. If you need this feature please use that fork.

bramski commented 5 years ago

Then add some other collaborators @theozaurus. So many dead github projects with maintainers who close issues and don't allow the community to take over.

bramski commented 5 years ago

I actually have no idea why you closed it. It's clearly an issue.

theozaurus commented 5 years ago

@bramski this isn't an issue for me. I've shared the code under MIT which allows you to use this code with very little restriction. You are not prevented from modifying this code and you are welcome to open your fork to other maintainers and handle issues.

bramski commented 5 years ago

Boo. I don't want it either. I'm happy to make the contribution but I don't work for the company that used this fork anymore. Just more garbage circling the github blackhole.