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

Allow overriding Prism module with options #16

Closed ngs closed 7 years ago

ngs commented 7 years ago

Hi,

I've added an option to override Prism module to use in the decorator.

I wanted this feature to customized Prism module with plugins and components.

import PrismDecorator from 'draft-js-prism';
import Prism from 'prismjs';
import 'prismjs/components/prism-java';
import 'prismjs/components/prism-scala';
import 'prismjs/components/prism-go';
import 'prismjs/components/prism-sql';
import 'prismjs/components/prism-bash';
import 'prismjs/components/prism-c';
import 'prismjs/components/prism-cpp';
import 'prismjs/components/prism-kotlin';
import 'prismjs/components/prism-perl';
import 'prismjs/components/prism-ruby';
import 'prismjs/components/prism-swift';

const decorators = [new PrismDecorator({
  prism: Prism
})];

// ...
mxstbr commented 7 years ago

This is awesome, would love to have this merged! Should probably also add prismjs to the peerDependencies to make sure folks install it?