diff --git a/README.md b/README.md index 4678667..e5baf58 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,11 @@ Then open [`localhost:8000`](http://localhost:8000) in a browser. ## Installation -The easiest way to use codemirror is to install it from NPM and include it in your own React build process (using [Browserify](http://browserify.org), [Webpack](http://webpack.github.io/), etc). +``` +npm install react-md-editor --save +``` + +And you may need to install codemirror. The easiest way to use codemirror is to install it from NPM and include it in your own React build process (using [Browserify](http://browserify.org), [Webpack](http://webpack.github.io/), etc). You can also use the standalone build by including `dist/codemirror.js` in your page. If you use this, make sure you have already included React, and it is available as a global variable. @@ -29,13 +33,16 @@ You can also use the standalone build by including `dist/codemirror.js` in your npm install codemirror --save ``` - ## Usage ```js var React = require('react'), Editor = require('react-md-editor'); +// you may need import css in your js if you use webpack or tools can build css +// or @import in your less file like [the example.less](https://github.com/JedWatson/react-md-editor/blob/master/example/src/example.less#L77) +// import 'react-md-editor/dist/react-md-editor.min.css'; + var App = React.createClass({ getInitialState: function() { return { diff --git a/src/MDEditor.js b/src/MDEditor.js index e769288..9a89256 100644 --- a/src/MDEditor.js +++ b/src/MDEditor.js @@ -17,6 +17,7 @@ var MarkdownEditor = React.createClass({ options: React.PropTypes.object, path: React.PropTypes.string, value: React.PropTypes.string, + className: React.PropTypes.string, }, getInitialState () { @@ -125,9 +126,10 @@ var MarkdownEditor = React.createClass({ }, render () { + var editorWrapperClassName = classNames('MDEditor', this.props.className); var editorClassName = classNames('MDEditor_editor', { 'MDEditor_editor--focused': this.state.isFocused }); return ( -