Skip to content

Commit

Permalink
Merge pull request #232 from edge/fix/223-clipboard-check-update
Browse files Browse the repository at this point in the history
fix: update clipboard check to be in line with explorer
  • Loading branch information
annybs authored Jun 6, 2023
2 parents d199960 + 9b878f7 commit b1edd86
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
10 changes: 4 additions & 6 deletions src/components/index/CreateModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
</button>
<button
class="flex-shrink-0 w-24 ml-24 text-green on-clicked-effect"
v-if="canCopy"
@click="copyToClipboard(address)"
>
<ClipboardCopyIcon/>
Expand All @@ -33,7 +32,6 @@
</span>
<button
class="flex-shrink-0 w-24 text-green ml-18 on-clicked-effect"
v-if="canCopy"
@click="copyToClipboard(privateKey)"
>
<ClipboardCopyIcon/>
Expand Down Expand Up @@ -130,8 +128,6 @@ export default {
password: '',
confirmPhrase: '',
canCopy: !!navigator.clipboard,
phrase: confirmPhrase
}
},
Expand Down Expand Up @@ -174,8 +170,10 @@ export default {
this.create()
},
copyToClipboard(input) {
if (!this.canCopy) window.alert('Clipboard unavailable. Please copy-paste manually.')
return navigator.clipboard.writeText(input)
if (!!navigator.clipboard) {
return navigator.clipboard.writeText(input)
}
window.alert('Clipboard unavailable. Please copy-paste manually.')
},
generateWallet() {
const wallet = xe.wallet.create()
Expand Down
11 changes: 5 additions & 6 deletions src/components/index/ExportModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
<span class="font-mono break-all text-sm2">{{ address }}</span>
<button
class="flex-shrink-0 w-24 ml-24 text-green on-clicked-effect"
v-if="canCopy"
@click.prevent="copyToClipboard(address)"
>
<ClipboardCopyIcon/>
Expand All @@ -53,7 +52,6 @@
</span>
<button
class="flex-shrink-0 w-24 text-green ml-18 on-clicked-effect"
v-if="canCopy"
@click.prevent="copyToClipboard(privateKey)"
>
<ClipboardCopyIcon/>
Expand Down Expand Up @@ -99,8 +97,7 @@ export default {
return {
password: '',
passwordError: '',
privateKey: '',
canCopy: !!navigator.clipboard
privateKey: ''
}
},
validations() {
Expand Down Expand Up @@ -154,8 +151,10 @@ export default {
this.exportKey()
},
copyToClipboard(input) {
if (!this.canCopy) window.alert('Clipboard unavailable. Please copy-paste manually.')
return navigator.clipboard.writeText(input)
if (!!navigator.clipboard) {
return navigator.clipboard.writeText(input)
}
window.alert('Clipboard unavailable. Please copy-paste manually.')
}
},
setup() {
Expand Down

0 comments on commit b1edd86

Please sign in to comment.