1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-31 10:51:44 +02:00

Merge branch 'master' of github.com:ianstormtaylor/slate

This commit is contained in:
Ian Storm Taylor
2017-02-13 17:01:27 -08:00
5 changed files with 12 additions and 1 deletions

View File

@@ -80,7 +80,7 @@ class LargeDocument extends React.Component {
<Editor <Editor
placeholder={'Enter some plain text...'} placeholder={'Enter some plain text...'}
schema={schema} schema={schema}
spellcheck={false} spellCheck={false}
state={this.state.state} state={this.state.state}
onChange={this.onChange} onChange={this.onChange}
/> />

View File

@@ -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')}

View File

@@ -61,6 +61,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,
@@ -86,6 +87,7 @@ class Editor extends React.Component {
*/ */
static defaultProps = { static defaultProps = {
autoCorrect: true,
onChange: noop, onChange: noop,
onDocumentChange: noop, onDocumentChange: noop,
onSelectionChange: noop, onSelectionChange: noop,
@@ -253,6 +255,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}

View File

@@ -260,6 +260,7 @@ const Node = {
return this return this
.getTexts() .getTexts()
.map(text => this.getClosestBlock(text.key)) .map(text => this.getClosestBlock(text.key))
// Eliminate duplicates
.toOrderedSet() .toOrderedSet()
.toList() .toList()
}, },
@@ -275,6 +276,9 @@ const Node = {
return this return this
.getTextsAtRange(range) .getTextsAtRange(range)
.map(text => this.getClosestBlock(text.key)) .map(text => this.getClosestBlock(text.key))
// Eliminate duplicates
.toOrderedSet()
.toList()
}, },
/** /**

View File

@@ -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')