1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Fix click to copy for private key not working (#2360)

This commit is contained in:
Alexander Tseung 2017-10-13 16:23:10 -04:00 committed by Daniel Tsui
parent 803eaaf968
commit 222a203353
3 changed files with 11 additions and 7 deletions

View File

@ -7,6 +7,7 @@ const actions = require('../../actions')
const AccountModalContainer = require('./account-modal-container') const AccountModalContainer = require('./account-modal-container')
const { getSelectedIdentity } = require('../../selectors') const { getSelectedIdentity } = require('../../selectors')
const ReadOnlyInput = require('../readonly-input') const ReadOnlyInput = require('../readonly-input')
const copyToClipboard = require('copy-to-clipboard')
function mapStateToProps (state) { function mapStateToProps (state) {
return { return {
@ -61,11 +62,12 @@ ExportPrivateKeyModal.prototype.renderPasswordInput = function (privateKey) {
inputClass: 'private-key-password-display-textarea', inputClass: 'private-key-password-display-textarea',
textarea: true, textarea: true,
value: plainKey, value: plainKey,
onClick: () => copyToClipboard(plainKey),
}) })
: h('input.private-key-password-input', { : h('input.private-key-password-input', {
type: 'password', type: 'password',
placeholder: 'Type password', placeholder: 'Type password',
onChange: event => this.setState({ password: event.target.value }) onChange: event => this.setState({ password: event.target.value }),
}) })
} }
@ -115,7 +117,7 @@ ExportPrivateKeyModal.prototype.render = function () {
}), }),
h('div.account-modal-divider'), h('div.account-modal-divider'),
h('span.modal-body-title', 'Download Private Keys'), h('span.modal-body-title', 'Download Private Keys'),
h('div.private-key-password', {}, [ h('div.private-key-password', {}, [
@ -132,6 +134,6 @@ ExportPrivateKeyModal.prototype.render = function () {
), ),
this.renderButtons(privateKey, this.state.password, address, hideModal), this.renderButtons(privateKey, this.state.password, address, hideModal),
]) ])
} }

View File

@ -15,6 +15,7 @@ ReadOnlyInput.prototype.render = function () {
inputClass = '', inputClass = '',
value, value,
textarea, textarea,
onClick,
} = this.props } = this.props
const inputType = textarea ? 'textarea' : 'input' const inputType = textarea ? 'textarea' : 'input'
@ -25,6 +26,7 @@ ReadOnlyInput.prototype.render = function () {
value, value,
readOnly: true, readOnly: true,
onFocus: event => event.target.select(), onFocus: event => event.target.select(),
onClick,
}), }),
]) ])
} }

View File

@ -356,18 +356,18 @@
.private-key-password-display-wrapper { .private-key-password-display-wrapper {
height: 80px; height: 80px;
width: 291px; width: 291px;
border: 1px solid $silver; border: 1px solid $silver;
border-radius: 2px; border-radius: 2px;
} }
.private-key-password-display-textarea { .private-key-password-display-textarea {
color: $crimson; color: $crimson;
font-family: Roboto; font-family: Roboto;
font-size: 16px; font-size: 16px;
line-height: 21px; line-height: 21px;
border: none; border: none;
height: 75px; height: 75px;
width: 253px; width: 100%;
overflow: hidden; overflow: hidden;
resize: none; resize: none;
padding: 9px 13px 8px; padding: 9px 13px 8px;