From c230c53b11a9e1c79b8580896a1c297cf532a065 Mon Sep 17 00:00:00 2001 From: bingryan <41174435+bingryan@users.noreply.github.com> Date: Wed, 26 Apr 2023 16:15:44 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20use=20insertText=20replac?= =?UTF-8?q?e=20insertHTML=20(#27)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 🐛 use insertText replace insertHTML --- src/components/EditableContent/index.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/EditableContent/index.vue b/src/components/EditableContent/index.vue index 2fe157a..10ddbc7 100644 --- a/src/components/EditableContent/index.vue +++ b/src/components/EditableContent/index.vue @@ -104,7 +104,9 @@ // text if (items[i].type.indexOf('text/plain') !== -1) { items[i].getAsString((str) => { - document.execCommand('insertHTML', false, str); + // when str is html tag, use insertHTML + // when str is plain text, use insertText + document.execCommand('insertText', false, str); }); }