SamyPesse / draft-js-prism

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

Fix the default getSyntax #13

Closed goddyZhao closed 6 years ago

goddyZhao commented 8 years ago

Since the latest version of this project has changed the default syntax from javascript to null, and it check the syntax by the block data, I just wonder how can I set the block data for it? I tried Modifier.setBlockData after toggleStyle but it doesn't work. Any one knows how to make it? Thanks!

goddyZhao commented 8 years ago

BTW, the demo page of this project is still using the old version, do it works. But the demo for the latest one does not even work, thanks!

mattmacpherson commented 7 years ago

Has anyone figured this out?

J22Melody commented 7 years ago

+1

J22Melody commented 7 years ago

@goddyZhao @Method-X I just had a look at the source code, I guess lib/option.js line 23 return block.getData().syntax; should be return block.getData().get('syntax');, since block.getData() returns an Immutable.Map object.

mxstbr commented 7 years ago

This is a bug in our default getSyntax method, changing line 23 to block.getData().get('syntax') should work. PRs very welcome!