JSPM

react-texteditor

0.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1557
  • Score
    100M100P100Q110982F
  • License MIT

Rich Text Editor for React

Package Exports

  • react-texteditor

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-texteditor) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

TextEditor

Rich Text Editor for React using contentEditable. Uses ES6 through Babel.

Installation

Requires react and classnames to installed. They are not bundled in the package.

npm install react classnames react-texteditor --save-dev`

Usage

var React = require('react');
var TextEditor = require('react-texteditor');

var ExampleView = React.createClass({
    /**
     * Initial State
     *
     * @type    {Object}
     */
    getInitialState: {
        text: ''
    }

    /**
     * Handle a change in the editor
     *
     * @param     {String}    prop
     * @param     {Object}    event
     */
    handleChange: function(prop, event) {
        var state = this.state;
        state[prop] = event.target.value;
        this.setState(state);
    },

    /**
     * Render
     *
     * @return    {React}
     */
    render: function() {
        return (
            <TextEditor
                  onChange={this.handleChange.bind(this, 'text')}
                  html={this.state.html} />
        );
    }
});

Development

Source files are located in src/ and can be built with grunt build command after running npm install. Transformed files are saved to the dist/ folder.

If you're using webpack with the babel loader you can directly require the src/ folder, e.g.

var TextEditor = require('react-texteditor/src');