From dcbb9a98cab787293adae5018053a580691bab5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20M=C3=BCller?= Date: Wed, 12 Oct 2016 23:42:08 +0200 Subject: [PATCH] Make sure the `ql-blank` gets always removed when editor has content Closes #1043. --- core/quill.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/core/quill.js b/core/quill.js index d965245b29..0b6d6828f7 100644 --- a/core/quill.js +++ b/core/quill.js @@ -61,6 +61,11 @@ 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: this.options.formats @@ -81,10 +86,6 @@ class Quill { if (this.options.placeholder) { this.root.setAttribute('data-placeholder', this.options.placeholder); } - this.root.classList.toggle('ql-blank', this.editor.isBlank()); - this.emitter.on(Emitter.events.TEXT_CHANGE, (delta) => { - this.root.classList.toggle('ql-blank', this.editor.isBlank()); - }); } addContainer(container, refNode = null) {