feat: add transaction to all events if possible, see #1461

This commit is contained in:
Philipp Kühn 2021-08-13 14:00:50 +02:00
parent d9abb0c736
commit 7f6ed0b1c0
2 changed files with 7 additions and 4 deletions

View File

@ -322,6 +322,7 @@ export class Editor extends EventEmitter {
if (selectionHasChanged) { if (selectionHasChanged) {
this.emit('selectionUpdate', { this.emit('selectionUpdate', {
editor: this, editor: this,
transaction,
}) })
} }
@ -332,6 +333,7 @@ export class Editor extends EventEmitter {
this.emit('focus', { this.emit('focus', {
editor: this, editor: this,
event: focus.event, event: focus.event,
transaction,
}) })
} }
@ -339,6 +341,7 @@ export class Editor extends EventEmitter {
this.emit('blur', { this.emit('blur', {
editor: this, editor: this,
event: blur.event, event: blur.event,
transaction,
}) })
} }

View File

@ -52,11 +52,11 @@ export interface EditorOptions {
enablePasteRules: boolean, enablePasteRules: boolean,
onBeforeCreate: (props: { editor: Editor }) => void, onBeforeCreate: (props: { editor: Editor }) => void,
onCreate: (props: { editor: Editor }) => void, onCreate: (props: { editor: Editor }) => void,
onUpdate: (props: { editor: Editor }) => void, onUpdate: (props: { editor: Editor, transaction: Transaction }) => void,
onSelectionUpdate: (props: { editor: Editor }) => void, onSelectionUpdate: (props: { editor: Editor, transaction: Transaction }) => void,
onTransaction: (props: { editor: Editor, transaction: Transaction }) => void, onTransaction: (props: { editor: Editor, transaction: Transaction }) => void,
onFocus: (props: { editor: Editor, event: FocusEvent }) => void, onFocus: (props: { editor: Editor, event: FocusEvent, transaction: Transaction }) => void,
onBlur: (props: { editor: Editor, event: FocusEvent }) => void, onBlur: (props: { editor: Editor, event: FocusEvent, transaction: Transaction }) => void,
onDestroy: () => void, onDestroy: () => void,
} }