Closed rgbkrk closed 8 years ago
I agree, but this is not the goal of this module, draftjs-prism
should only provide the code highlighting decorator, not the keyboard handling.
Since I'm going to work on this for our application at GitBook, I'll probably publish a module like draftjs-code
to provide helpers for this.
Something like this, which can be composed with other keyboard handling:
var CodeUtils = require('draftjs-code')
render() {
return (
<Editor
editorState={this.state.editorState}
handleKeyCommand={CodeUtils.handleKeyCommand}
keyBindingFn={CodeUtils.keyBinding}
...
/>
);
}
@rgbkrk I'm working on draft-js-code to do this, take a look at the demo: http://samypesse.github.io/draft-js-code/
That's a great demo! Thanks.
Tab is the default behavior currently, it would be great to have this as space insertion similar to codemirror.