From a3369e686cf3a5ed1b5f3e45f52b03fb3685e568 Mon Sep 17 00:00:00 2001 From: Serik Date: Thu, 11 Jul 2024 02:58:45 +0500 Subject: [PATCH] clear text before pasting --- components/wysiwyg-editor.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/components/wysiwyg-editor.js b/components/wysiwyg-editor.js index 9dc39ad..ecd2ca8 100644 --- a/components/wysiwyg-editor.js +++ b/components/wysiwyg-editor.js @@ -54,6 +54,16 @@ class WYSIWYGEditor extends LitElement { if (this.content) { editor.innerHTML = this.content } + + + editor.addEventListener('paste', (e) => { + e.preventDefault(); + + console.log("pasing: ", e); + + let text = e.clipboardData.getData('text/plain'); + document.execCommand('insertText', false, text); + }); }, 1000); }