draft-js-prism icon indicating copy to clipboard operation
draft-js-prism copied to clipboard

Can't get it working. Tokenization not happening.

Open pReya opened this issue 5 years ago • 2 comments

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

pReya avatar Mar 20 '19 13:03 pReya

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

Philjutsu avatar Jul 02 '19 01:07 Philjutsu

@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.

Philjutsu avatar Jul 02 '19 19:07 Philjutsu