Improve usage docs
mogavin opened this issue · 1 comments
mogavin commented
Description
Update the usage documentation to use the example below:
import React from "react";
import ReactDOM from "react-dom";
import {MegadraftEditor, editorStateFromRaw} from "megadraft";
//Import megadraft.css
import 'megadraft/dist/css/megadraft.css'
class App extends React.Component {
constructor(props) {
super(props);
this.state = {editorState: editorStateFromRaw(null)};
}
onChange = (editorState) => {
this.setState({editorState});
}
render() {
return (
//Add some margin left to show plugins sidebar
<div style={{marginLeft: 80}}>
<MegadraftEditor
editorState={this.state.editorState}
onChange={this.onChange}/>
</div>
)
}
}
ReactDOM.render(
<App />,
document.getElementById('container')
);
Motivation
-
CSS link does not work in the current example (#298):
<link href="node_modules/megadraft/dist/css/megadraft.css" rel="stylesheet">
-
Lack of margin inclusion makes the plugin sidebar hidden.
mogavin commented
Merged in release 0.7.0-alpha.0