1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-15 11:44:05 +02:00

Apply stack.onBeforeChange in editor.onChange (#1183)

This commit is contained in:
Nicolas Gaborit
2017-09-26 19:06:05 +02:00
committed by Ian Storm Taylor
parent c98ad903c8
commit dba3497b77

View File

@@ -130,8 +130,6 @@ class Editor extends React.Component {
const stk = this.state.stack
const change = this.state.state.change()
stk[method](change, this, ...args)
stk.onBeforeChange(change, this)
stk.onChange(change, this)
this.onChange(change)
}
}
@@ -240,10 +238,14 @@ class Editor extends React.Component {
}
const { onChange, onDocumentChange, onSelectionChange } = this.props
const { stack } = this.state
const { document, selection } = this.tmp
const { state } = change
if (state == this.state.state) return
stack.onBeforeChange(change, this)
stack.onChange(change, this)
onChange(change)
if (onDocumentChange && state.document != document) onDocumentChange(state.document, change)
if (onSelectionChange && state.selection != selection) onSelectionChange(state.selection, change)