mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-17 04:34:00 +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 stk = this.state.stack
|
||||||
const change = this.state.state.change()
|
const change = this.state.state.change()
|
||||||
stk[method](change, this, ...args)
|
stk[method](change, this, ...args)
|
||||||
stk.onBeforeChange(change, this)
|
|
||||||
stk.onChange(change, this)
|
|
||||||
this.onChange(change)
|
this.onChange(change)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -240,10 +238,14 @@ class Editor extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const { onChange, onDocumentChange, onSelectionChange } = this.props
|
const { onChange, onDocumentChange, onSelectionChange } = this.props
|
||||||
|
const { stack } = this.state
|
||||||
const { document, selection } = this.tmp
|
const { document, selection } = this.tmp
|
||||||
const { state } = change
|
const { state } = change
|
||||||
if (state == this.state.state) return
|
if (state == this.state.state) return
|
||||||
|
|
||||||
|
stack.onBeforeChange(change, this)
|
||||||
|
stack.onChange(change, this)
|
||||||
|
|
||||||
onChange(change)
|
onChange(change)
|
||||||
if (onDocumentChange && state.document != document) onDocumentChange(state.document, change)
|
if (onDocumentChange && state.document != document) onDocumentChange(state.document, change)
|
||||||
if (onSelectionChange && state.selection != selection) onSelectionChange(state.selection, change)
|
if (onSelectionChange && state.selection != selection) onSelectionChange(state.selection, change)
|
||||||
|
Reference in New Issue
Block a user