@lapa/react-contenteditable
TypeScript icon, indicating that this package has built-in type declarations

3.3.0 • Public • Published

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 editing
              onChange={this.handleChange} // handle innerHTML change
              tagName='article' // Use a custom HTML tag (uses a div by default)
            />
  };
};

Examples

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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 3.3.0
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 3.3.0
    1
  • 3.2.0
    0
  • 3.1.0
    0

Package Sidebar

Install

npm i @lapa/react-contenteditable

Weekly Downloads

1

Version

3.3.0

License

Apache-2.0

Unpacked Size

27.1 kB

Total Files

6

Last publish

Collaborators

  • gausie