mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-29 09:59:48 +02:00
Add props “autoCorrect” to editor and content. (#596)
This allow user to turn off predictive text input on iOS thus mitigating #540…
This commit is contained in:
committed by
Ian Storm Taylor
parent
e1ea15a86f
commit
3a23c21848
@@ -35,6 +35,7 @@ class Content extends React.Component {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
|
autoCorrect: React.PropTypes.bool.isRequired,
|
||||||
className: React.PropTypes.string,
|
className: React.PropTypes.string,
|
||||||
editor: React.PropTypes.object.isRequired,
|
editor: React.PropTypes.object.isRequired,
|
||||||
onBeforeInput: React.PropTypes.func.isRequired,
|
onBeforeInput: React.PropTypes.func.isRequired,
|
||||||
@@ -98,6 +99,7 @@ class Content extends React.Component {
|
|||||||
return (
|
return (
|
||||||
props.className != this.props.className ||
|
props.className != this.props.className ||
|
||||||
props.schema != this.props.schema ||
|
props.schema != this.props.schema ||
|
||||||
|
props.autoCorrect != this.props.autoCorrect ||
|
||||||
props.spellCheck != this.props.spellCheck ||
|
props.spellCheck != this.props.spellCheck ||
|
||||||
props.state != this.props.state ||
|
props.state != this.props.state ||
|
||||||
props.style != this.props.style
|
props.style != this.props.style
|
||||||
@@ -747,6 +749,7 @@ class Content extends React.Component {
|
|||||||
onKeyUp={this.onKeyUp}
|
onKeyUp={this.onKeyUp}
|
||||||
onPaste={this.onPaste}
|
onPaste={this.onPaste}
|
||||||
onSelect={this.onSelect}
|
onSelect={this.onSelect}
|
||||||
|
autoCorrect={props.autoCorrect}
|
||||||
spellCheck={spellCheck}
|
spellCheck={spellCheck}
|
||||||
style={style}
|
style={style}
|
||||||
role={readOnly ? null : (role || 'textbox')}
|
role={readOnly ? null : (role || 'textbox')}
|
||||||
|
@@ -58,6 +58,7 @@ class Editor extends React.Component {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
|
autoCorrect: React.PropTypes.bool,
|
||||||
className: React.PropTypes.string,
|
className: React.PropTypes.string,
|
||||||
onBeforeChange: React.PropTypes.func,
|
onBeforeChange: React.PropTypes.func,
|
||||||
onChange: React.PropTypes.func,
|
onChange: React.PropTypes.func,
|
||||||
@@ -83,6 +84,7 @@ class Editor extends React.Component {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
|
autoCorrect: true,
|
||||||
onChange: noop,
|
onChange: noop,
|
||||||
onDocumentChange: noop,
|
onDocumentChange: noop,
|
||||||
onSelectionChange: noop,
|
onSelectionChange: noop,
|
||||||
@@ -250,6 +252,7 @@ class Editor extends React.Component {
|
|||||||
state={this.getState()}
|
state={this.getState()}
|
||||||
className={props.className}
|
className={props.className}
|
||||||
readOnly={props.readOnly}
|
readOnly={props.readOnly}
|
||||||
|
autoCorrect={props.autoCorrect}
|
||||||
spellCheck={props.spellCheck}
|
spellCheck={props.spellCheck}
|
||||||
style={props.style}
|
style={props.style}
|
||||||
tabIndex={props.tabIndex}
|
tabIndex={props.tabIndex}
|
||||||
|
@@ -56,6 +56,7 @@ function clean(html) {
|
|||||||
$(el).removeAttr('data-offset-key')
|
$(el).removeAttr('data-offset-key')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
$.root().children().removeAttr('autocorrect')
|
||||||
$.root().children().removeAttr('spellcheck')
|
$.root().children().removeAttr('spellcheck')
|
||||||
$.root().children().removeAttr('style')
|
$.root().children().removeAttr('style')
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user