JSPM

  • Created
  • Published
  • Downloads 183203
  • Score
    100M100P100Q161055F
  • License Apache-2.0

React component representing a <div> with editable contents

Package Exports

  • react-contenteditable

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-contenteditable) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

react-contenteditable

React component for a div with editable contents

Build Status

Install

npm install react-contenteditable

Usage

import ContentEditable from 'react-contenteditable'

class MyComponent extends React.Component {
  constructor() {
    super()
    this.state = {html: "<b>Hello <i>World</i></b>"};
  };

  handleChange = evt => {
    this.setState({html: evt.target.value});
  };

  render = () => {
    return <ContentEditable
              html={this.state.html} // innerHTML of the editable div
              disabled={false}       // use true to disable edition
              onChange={this.handleChange} // handle innerHTML change
            />
  };
};

Examples

You can try react-contenteditable right from your browser to see if it fits your project's needs:

Structure of this repository

  • lib/ compiled javascript, usable directly in the browser
  • src/ source javascript. Uses JSX and ES6.