Backporting to beta (#4741)
* New chains (#4720) * Add Kovan chain. * Fix up --testnet. * Fix tests. * Fix test. * fix test * Fix test. * Fix to UglifyJS 2.8.2 to fix app build issues (#4723) * Update classic bootnodes, ref #4717 (#4735) * allow failure docker beta * adjust pruning history default to 64 (#4709) * backporting from master [ci-skip]update docker-build.sh * update gitlab.ci fix docker hub build [ci skip] * update gitlab docker beta-release->latest * Add registry. * Add info on forks. * Fixed spec file * Support both V1 & V2 DataChanged events in registry (#4734) * Add info on forks. * Add new registry ABI * Import registry2 & fix exports * Select ABI based on code hash * Render new event types (owner not available) * New registry. * Rename old chain. * Fix test. * Another fix. * Finish rename. * Fixed fonts URLs (#4579) * Fix Token Reg Dapp issues in Firefox (#4489) * Fix overflow issues in Firefox (#4348) * Fix wrong Promise inferance * Add new Componennt for Token Images (#4496) * Revert "Add new Componennt for Token Images (#4496)" This reverts commit 6ffbdab891f85e4d988e3e8e96fc2c651bd68e04. * Add StackEventListener (#4745) * Update testnet detection (#4746) * Fix Account Selection in Signer (#4744) * Can pass FormattedMessage to Input (eg. Status // RPC Enabled) * Simple fixed-width fix for Accoutn Selection in Parity Signer
This commit is contained in:
@@ -46,6 +46,10 @@ const UNDERLINE_FOCUSED = {
|
||||
const NAME_ID = ' ';
|
||||
|
||||
export default class Input extends Component {
|
||||
static contextTypes = {
|
||||
intl: React.PropTypes.object.isRequired
|
||||
};
|
||||
|
||||
static propTypes = {
|
||||
allowCopy: PropTypes.oneOfType([
|
||||
PropTypes.string,
|
||||
@@ -78,7 +82,8 @@ export default class Input extends Component {
|
||||
style: PropTypes.object,
|
||||
value: PropTypes.oneOfType([
|
||||
PropTypes.number,
|
||||
PropTypes.string
|
||||
PropTypes.string,
|
||||
PropTypes.node
|
||||
])
|
||||
};
|
||||
|
||||
@@ -134,6 +139,13 @@ export default class Input extends Component {
|
||||
? UNDERLINE_FOCUSED
|
||||
: readOnly && typeof focused !== 'boolean' ? { display: 'none' } : null;
|
||||
|
||||
const textValue = typeof value !== 'string' && (value && value.props)
|
||||
? this.context.intl.formatMessage(
|
||||
value.props,
|
||||
value.props.values || {}
|
||||
)
|
||||
: value;
|
||||
|
||||
return (
|
||||
<div className={ styles.container } style={ style }>
|
||||
{ this.renderCopyButton() }
|
||||
@@ -168,7 +180,8 @@ export default class Input extends Component {
|
||||
underlineStyle={ underlineStyle }
|
||||
underlineFocusStyle={ underlineFocusStyle }
|
||||
underlineShow={ !hideUnderline }
|
||||
value={ value }>
|
||||
value={ textValue }
|
||||
>
|
||||
{ children }
|
||||
</TextField>
|
||||
</div>
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import EventListener from 'react-event-listener';
|
||||
import React, { Component, PropTypes } from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import ReactPortal from 'react-portal';
|
||||
@@ -23,6 +22,7 @@ import keycode from 'keycode';
|
||||
import { nodeOrStringProptype } from '~/util/proptypes';
|
||||
import { CloseIcon } from '~/ui/Icons';
|
||||
import ParityBackground from '~/ui/ParityBackground';
|
||||
import StackEventListener from '~/ui/StackEventListener';
|
||||
import Title from '~/ui/Title';
|
||||
|
||||
import styles from './portal.css';
|
||||
@@ -92,10 +92,7 @@ export default class Portal extends Component {
|
||||
onClick={ this.stopEvent }
|
||||
onKeyDown={ this.handleKeyDown }
|
||||
>
|
||||
<EventListener
|
||||
target='window'
|
||||
onKeyUp={ this.handleKeyUp }
|
||||
/>
|
||||
<StackEventListener onKeyUp={ this.handleKeyUp } />
|
||||
<ParityBackground className={ styles.parityBackground } />
|
||||
{ this.renderClose() }
|
||||
<Title
|
||||
@@ -174,7 +171,7 @@ export default class Portal extends Component {
|
||||
switch (codeName) {
|
||||
case 'esc':
|
||||
event.preventDefault();
|
||||
return this.handleClose();
|
||||
return this.props.onClose();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
17
js/src/ui/StackEventListener/index.js
Normal file
17
js/src/ui/StackEventListener/index.js
Normal file
@@ -0,0 +1,17 @@
|
||||
// Copyright 2015-2017 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Parity.
|
||||
|
||||
// Parity is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Parity is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
export default from './stackEventListener';
|
||||
56
js/src/ui/StackEventListener/stackEventListener.js
Normal file
56
js/src/ui/StackEventListener/stackEventListener.js
Normal file
@@ -0,0 +1,56 @@
|
||||
// Copyright 2015-2017 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Parity.
|
||||
|
||||
// Parity is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Parity is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import ReactEventListener from 'react-event-listener';
|
||||
import React, { Component, PropTypes } from 'react';
|
||||
|
||||
let listenerId = 0;
|
||||
let listenerIds = [];
|
||||
|
||||
export default class StackEventListener extends Component {
|
||||
static propTypes = {
|
||||
onKeyUp: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
componentWillMount () {
|
||||
// Add to the list of listeners on mount
|
||||
this.id = ++listenerId;
|
||||
listenerIds.push(this.id);
|
||||
}
|
||||
|
||||
componentWillUnmount () {
|
||||
// Remove from the listeners list on unmount
|
||||
listenerIds = listenerIds.filter((id) => this.id !== id);
|
||||
}
|
||||
|
||||
render () {
|
||||
return (
|
||||
<ReactEventListener
|
||||
target='window'
|
||||
onKeyUp={ this.handleKeyUp }
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
handleKeyUp = (event) => {
|
||||
// Only handle event if last of the listeners list
|
||||
if (this.id !== listenerIds.slice(-1)[0]) {
|
||||
return event;
|
||||
}
|
||||
|
||||
return this.props.onKeyUp(event);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user