Skip to content

Commit

Permalink
clear text before pasting
Browse files Browse the repository at this point in the history
  • Loading branch information
serikshaikamalov committed Jul 10, 2024
1 parent 779c8fe commit a3369e6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions components/wysiwyg-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit a3369e6

Please sign in to comment.