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

Warning in latest React: "Unknown props `decoratedText`, `entityKey`, `offsetKey` on <span> tag" #15

Closed vdanchenkov closed 6 years ago

vdanchenkov commented 7 years ago
Warning: Unknown props `decoratedText`, `entityKey`, `offsetKey` on <span> tag. Remove these props from the element. For details, see https://fb.me/react-unknown-prop
    in span (created by defaultRender)
    in defaultRender (created by DraftEditorBlock)
    in div (created by DraftEditorBlock)
    in DraftEditorBlock (created by DraftEditorContents)
    in div (created by DraftEditorContents)
    in div (created by DraftEditorContents)
    in DraftEditorContents (created by DraftEditor)
    in div (created by DraftEditor)

I'm not sure if we need to pass any props to that span. Workaround is to create you own renderer.

const decorator = new PrismDecorator({
  render: ({type, children}) => <span className={`prism-token token ${type}`}>{children}</span>
})
mxstbr commented 7 years ago

PRs to fix this very welcome!