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