Skip to content

Commit

Permalink
Make sure the ql-blank gets always removed when editor has content
Browse files Browse the repository at this point in the history
Closes slab#1043.
  • Loading branch information
jacobmllr95 authored and Tim McClure committed Dec 12, 2016
1 parent 49a4f59 commit c734e07
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions core/quill.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) {
Expand Down

0 comments on commit c734e07

Please sign in to comment.