add transaction event
This commit is contained in:
@@ -29,7 +29,7 @@ export default class Collaboration extends Extension {
|
||||
}
|
||||
}, this.options.debounce)
|
||||
|
||||
this.editor.on('update', ({ state }) => {
|
||||
this.editor.on('transaction', ({ state }) => {
|
||||
this.getSendableSteps(state)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ export default class Editor extends Emitter {
|
||||
dropCursor: {},
|
||||
parseOptions: {},
|
||||
onInit: () => {},
|
||||
onTransaction: () => {},
|
||||
onUpdate: () => {},
|
||||
onFocus: () => {},
|
||||
onBlur: () => {},
|
||||
@@ -49,6 +50,7 @@ export default class Editor extends Emitter {
|
||||
|
||||
this.events = [
|
||||
'init',
|
||||
'transaction',
|
||||
'update',
|
||||
'focus',
|
||||
'blur',
|
||||
@@ -311,6 +313,13 @@ export default class Editor extends Emitter {
|
||||
this.view.updateState(newState)
|
||||
this.setActiveNodesAndMarks()
|
||||
|
||||
this.emit('transaction', {
|
||||
getHTML: this.getHTML.bind(this),
|
||||
getJSON: this.getJSON.bind(this),
|
||||
state: this.state,
|
||||
transaction,
|
||||
})
|
||||
|
||||
if (!transaction.docChanged) {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user