mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-15 03:33:59 +02:00
Apply stack.onBeforeChange in editor.onChange (#1183)
This commit is contained in:
committed by
Ian Storm Taylor
parent
c98ad903c8
commit
dba3497b77
@@ -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)
|
||||
|
Reference in New Issue
Block a user