react-sane-contenteditable
React component with sane defaults to make any element contentEditable
https://jsfiddle.net/zp2v824s/show
DEMO:Why?
ContentEditable has some well known issues, and the purpose of this component is to deal with them in a sane manner so we don't have to continue re-inventing the wheel! 🔥
- Clean and sanitise the output
- Remove rich text formatting when pasting
- Prevent the cursor from jumping around
Example
import React Component from 'react';import ContentEditable from 'react-sane-contenteditable'; { ; thisstate = title: 'Title here' ; } { this; }; { return <div ="App"> <ContentEditable ="h1" ="my-class" = = = = = /> </div> ; }
Develop
Tests
yarn test
Linting
yarn run lint
Dev
Runs the rollup dev server with file watching on both the src and demo
yarn run dev