1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-04-19 12:51:59 +02:00

fix caching logic for onDocumentChange and onSelectionChange, fixes #614 #553 #538

This commit is contained in:
Ian Storm Taylor 2017-02-28 15:25:55 -08:00
parent 93c34f6045
commit 1511d9f203
2 changed files with 3 additions and 5 deletions

View File

@ -136,7 +136,6 @@ class Images extends React.Component {
schema={schema}
state={this.state.state}
onChange={this.onChange}
onDocumentChange={this.onDocumentChange}
onDrop={this.onDrop}
onPaste={this.onPaste}
/>

View File

@ -241,13 +241,12 @@ class Editor extends React.Component {
const { tmp, props } = this
const { stack } = this.state
const { onChange, onDocumentChange, onSelectionChange } = props
const { document, selection } = tmp
state = stack.onChange(state, this)
onChange(state)
if (state.document != tmp.document) onDocumentChange(state.document, state)
if (state.selection != tmp.selection) onSelectionChange(state.selection, state)
this.cacheState(state)
if (state.document != document) onDocumentChange(state.document, state)
if (state.selection != selection) onSelectionChange(state.selection, state)
}
/**