From cec838e1cbdc7deabca27e97b630401369a70644 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20M=C3=BCller?= Date: Wed, 12 Oct 2016 23:46:46 +0200 Subject: [PATCH] Make sure `this.editor` is initialized before registering emitter listener --- core/quill.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/core/quill.js b/core/quill.js index 15ea094772..acc09f3a6f 100644 --- a/core/quill.js +++ b/core/quill.js @@ -61,17 +61,17 @@ class Quill { this.container.innerHTML = ''; this.root = this.addContainer('ql-editor'); this.emitter = new Emitter(); - this.emitter.on(Emitter.events.EDITOR_CHANGE, (type) => { - if (type === Emitter.events.TEXT_CHANGE) { - this.root.classList.toggle('ql-blank', this.editor.isBlank()); - } - }); this.scroll = Parchment.create(this.root, { emitter: this.emitter, whitelist: options.formats }); this.editor = new Editor(this.scroll, this.emitter); this.selection = new Selection(this.scroll, this.emitter); + this.emitter.on(Emitter.events.EDITOR_CHANGE, (type) => { + if (type === Emitter.events.TEXT_CHANGE) { + this.root.classList.toggle('ql-blank', this.editor.isBlank()); + } + }); this.theme = new options.theme(this, options); this.keyboard = this.theme.addModule('keyboard'); this.clipboard = this.theme.addModule('clipboard');