From 5ec5168cc17dd8bf75f0d91d3b1486ad42d07ede Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Fri, 17 May 2019 23:29:32 +0200 Subject: [PATCH] use handleDOMEvents for focus and blur events --- packages/tiptap/src/Editor.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/tiptap/src/Editor.js b/packages/tiptap/src/Editor.js index 6b3fc1ac..88736e10 100644 --- a/packages/tiptap/src/Editor.js +++ b/packages/tiptap/src/Editor.js @@ -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 }