react-graph-editor

0.3.0 • Public • Published

React Graph Editor

Heavily based on Draft.js, React Graph Editor is a framework for building graph-based editors like the Rasen Editor or Focus.

Example

import React from 'react';
import ReactDOM from 'react-dom';
import {
    Graph,
    GraphState,
} from 'react-graph-editor';
 
class Editor extends React.Component {
    constructor(props) {
        super(props);
        this.state = {graph: GraphState.createEmpty()};
        this.onChange = graph => this.setState({graph});
    }
 
    render() {
        const {graph} = this.state;
        return <Graph value={graph} onChange={this.onChange} />;
    }
}
 
ReactDOM.render(
    <Editor />,
    document.getElementById('container')
);

Docs

See the docs folder.

Readme

Keywords

Package Sidebar

Install

npm i react-graph-editor

Weekly Downloads

18

Version

0.3.0

License

MIT

Last publish

Collaborators

  • leops