0.3.0 • Published 7 years ago

react-graph-editor v0.3.0

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

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.