SamyPesse / draft-js-prism

Code highlighting for DraftJS using Prism
http://samypesse.github.io/draft-js-prism/
Apache License 2.0
275 stars 36 forks source link

Can't get it working. Tokenization not happening. #25

Open pReya opened 5 years ago

pReya commented 5 years ago

Hello everyone,

unfortunately I can't get the decorator to work, no matter what I do. Yes, I've seen the other issues and I've also set the defaultSyntax property. However, the decorator isn't even tokenizing the content, so it's not a css/display problem. I am under the impression, this might have to do with me using react-draft-wysiwyg. Any help would be appreciated. Maybe @mxstbr has an idea?

I've put a little demo of my problem in this sandbox: https://codesandbox.io/embed/k5zp1p297v

Philjutsu commented 5 years ago

Bump for the same issue with similar code. @pReya did you get this figured out 3 months back?

Philjutsu commented 5 years ago

@pReya I just figure this one out, the react-draft-wysiwyg Editor component is the issue. I switched to the Editor from draftjs itself and everything works fine. Even tried it with your sandbox example. When you console log the editorState it shows the decorator in the immutable object. When it goes through the react-draft-wysiwyg Editor component it is overwritten. Simple fix is to use the Editor from Draftjs.