Created
March 28, 2023 13:50
-
-
Save trungpv1601/5f0b280055f079eac4cd12bdfed82a41 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const setTweet = () => { | |
const commentEl = document.querySelector('[class="DraftEditor-root"]'); | |
const editable = commentEl.querySelector("[contenteditable]"); | |
const data = new DataTransfer(); | |
data.setData("text/plain", "Hello World! 😍"); | |
editable.dispatchEvent( | |
new ClipboardEvent("paste", { | |
bubbles: true, | |
clipboardData: data, | |
cancelable: true, | |
}) | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment