From 40b95fd23e7ac0d133ed24a7f2a714f7ff8eddeb Mon Sep 17 00:00:00 2001 From: Zihua Li Date: Thu, 24 Feb 2022 19:45:36 +0800 Subject: [PATCH] No need to setContents when container is empty --- core/quill.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/core/quill.js b/core/quill.js index f54c8bcb23..f24718b3cf 100644 --- a/core/quill.js +++ b/core/quill.js @@ -109,11 +109,13 @@ class Quill { source, ); }); - const contents = this.clipboard.convert({ - html: `${html}


`, - text: '\n', - }); - this.setContents(contents); + if (html) { + const contents = this.clipboard.convert({ + html: `${html}


`, + text: '\n', + }); + this.setContents(contents); + } this.history.clear(); if (this.options.placeholder) { this.root.setAttribute('data-placeholder', this.options.placeholder);