add oldstate to update event
This commit is contained in:
@@ -288,6 +288,8 @@ export default class Editor {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const oldState = this.state
|
||||||
|
|
||||||
this.state = this.state.apply(transaction)
|
this.state = this.state.apply(transaction)
|
||||||
this.view.updateState(this.state)
|
this.view.updateState(this.state)
|
||||||
this.setActiveNodesAndMarks()
|
this.setActiveNodesAndMarks()
|
||||||
@@ -296,14 +298,15 @@ export default class Editor {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
this.emitUpdate(transaction)
|
this.emitUpdate(transaction, oldState)
|
||||||
}
|
}
|
||||||
|
|
||||||
emitUpdate(transaction) {
|
emitUpdate(transaction, oldState) {
|
||||||
this.options.onUpdate({
|
this.options.onUpdate({
|
||||||
getHTML: this.getHTML.bind(this),
|
getHTML: this.getHTML.bind(this),
|
||||||
getJSON: this.getJSON.bind(this),
|
getJSON: this.getJSON.bind(this),
|
||||||
state: this.state,
|
state: this.state,
|
||||||
|
oldState,
|
||||||
transaction,
|
transaction,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user