use handleDOMEvents for focus and blur events
This commit is contained in:
@@ -205,6 +205,18 @@ export default class Editor extends Emitter {
|
||||
attributes: {
|
||||
tabindex: 0,
|
||||
},
|
||||
handleDOMEvents: {
|
||||
focus: event => this.emit('focus', {
|
||||
event,
|
||||
state: this.state,
|
||||
view: this.view,
|
||||
}),
|
||||
blur: event => this.emit('blur', {
|
||||
event,
|
||||
state: this.state,
|
||||
view: this.view,
|
||||
}),
|
||||
},
|
||||
},
|
||||
}),
|
||||
new Plugin({
|
||||
@@ -248,18 +260,6 @@ export default class Editor extends Emitter {
|
||||
|
||||
view.dom.style.whiteSpace = 'pre-wrap'
|
||||
|
||||
view.dom.addEventListener('focus', event => this.emit('focus', {
|
||||
event,
|
||||
state: this.state,
|
||||
view: this.view,
|
||||
}))
|
||||
|
||||
view.dom.addEventListener('blur', event => this.emit('blur', {
|
||||
event,
|
||||
state: this.state,
|
||||
view: this.view,
|
||||
}))
|
||||
|
||||
return view
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user