Skip to content

Commit

Permalink
Add a tip for user when custom paste failed
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack-Works committed May 2, 2019
1 parent f473e3b commit a19eb2f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/components/InjectedComponents/AdditionalPostBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,14 @@ export function AdditionalPostBox() {
selectElementContents(element)
await sleep(100)
document.dispatchEvent(new CustomEvent(CustomPasteEventId, { detail: fullPost }))
navigator.clipboard.writeText(fullPost)
// Prevent Custom Paste failed, this will cause service not available to user.
if (!element.innerText.match('🎼')) {
console.warn('Text not pasted to the text area')
navigator.clipboard.writeText(fullPost)
alert(
'Encrypted text has been copied into the clipboard!\nHowever, you need to paste it to the post box by yourself.',
)
}
Services.Crypto.publishPostAESKey(token)
}, [])
if (!username) {
Expand Down

0 comments on commit a19eb2f

Please sign in to comment.