Skip to content

Commit

Permalink
Merge pull request #3539 from quilljs/zh-init-perf
Browse files Browse the repository at this point in the history
No need to setContents when container is empty
  • Loading branch information
jhchen authored Mar 3, 2022
2 parents 6cbebf2 + 40b95fd commit 0f20a58
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions core/quill.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,13 @@ class Quill {
source,
);
});
const contents = this.clipboard.convert({
html: `${html}<p><br></p>`,
text: '\n',
});
this.setContents(contents);
if (html) {
const contents = this.clipboard.convert({
html: `${html}<p><br></p>`,
text: '\n',
});
this.setContents(contents);
}
this.history.clear();
if (this.options.placeholder) {
this.root.setAttribute('data-placeholder', this.options.placeholder);
Expand Down

0 comments on commit 0f20a58

Please sign in to comment.