react-sane-contenteditable
Advanced tools
Comparing version 1.1.1 to 1.1.2
{ | ||
"name": "react-sane-contenteditable", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "React component with sane defaults to make any element contentEditable", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -7,3 +7,3 @@ # react-sane-contenteditable | ||
## Why? | ||
ContentEditable has some known issues. The purpose of this component is to deal with the implementation details so you don't have to! 🔥 | ||
ContentEditable has some well known issues, and the purpose of this component is to deal with them so you don't have to! 🔥 | ||
@@ -10,0 +10,0 @@ * Clean and sanitise the output |
@@ -13,3 +13,3 @@ import React, { Component } from 'react'; | ||
tagName: PropTypes.string, | ||
} | ||
}; | ||
@@ -23,3 +23,3 @@ const defaultProps = { | ||
tagName: 'div', | ||
} | ||
}; | ||
@@ -76,4 +76,4 @@ class ContentEditable extends Component { | ||
_onChange = (ev) => { | ||
const { sanatise } = this.props; | ||
const rawValue = this.refs.element.innerText; | ||
const { sanitise } = this.props; | ||
const rawValue = this._element.innerText; | ||
const value = sanitise ? this.sanitiseValue(rawValue) : rawValue; | ||
@@ -98,3 +98,3 @@ | ||
const { sanitise } = this.props; | ||
const rawValue = this.refs.element.innerText; | ||
const rawValue = this._element.innerText; | ||
const value = sanitise ? this.sanitiseValue(rawValue) : rawValue; | ||
@@ -111,3 +111,3 @@ | ||
const { maxLength, multiLine } = this.props; | ||
const value = this.refs.element.innerText; | ||
const value = this._element.innerText; | ||
@@ -132,3 +132,3 @@ // return key | ||
{...omit(props, Object.keys(propTypes))} | ||
ref="element" | ||
ref={(c) => this._element = c;} | ||
style={{ whiteSpace: 'pre-wrap', ...props.style }} | ||
@@ -135,0 +135,0 @@ contentEditable={editable} |
94805