Simplification of keyup

pull/760/head
Vincent 5 years ago
parent f55e20d8ac
commit cf46548761

@ -1172,7 +1172,7 @@
"Confirmation dialog title that asks the user if they really wish to delete a public channel. Answer buttons use the strings 'ok' and 'cancel'. The deletion is permanent, i.e. it cannot be undone." "Confirmation dialog title that asks the user if they really wish to delete a public channel. Answer buttons use the strings 'ok' and 'cancel'. The deletion is permanent, i.e. it cannot be undone."
}, },
"deletePublicChannelConfirmation": { "deletePublicChannelConfirmation": {
"message": "Leave this public channel?", "message": "Leave this Open Group?",
"description": "description":
"Confirmation dialog text that tells the user what will happen if they leave the public channel." "Confirmation dialog text that tells the user what will happen if they leave the public channel."
}, },

@ -478,7 +478,7 @@ $session-element-border-green: 4px solid $session-color-green;
&-text { &-text {
@include session-color-subtle($session-color-white); @include session-color-subtle($session-color-white);
font-family: "SF Pro Text"; font-family: 'SF Pro Text';
font-weight: 300; font-weight: 300;
} }

@ -79,14 +79,13 @@
} }
.module-attachment-section__items { .module-attachment-section__items {
&-media { &-media {
display: grid; display: grid;
grid-template-columns: repeat(3, 1fr); grid-template-columns: repeat(3, 1fr);
width: 100%; width: 100%;
} }
&-documents { &-documents {
width: 100%; width: 100%;
} }
} }

@ -15,9 +15,9 @@ interface Props {
} }
export class AttachmentSection extends React.Component<Props> { export class AttachmentSection extends React.Component<Props> {
public render() { public render() {
const { type } = this.props; const { type } = this.props;
return ( return (
<div className="module-attachment-section"> <div className="module-attachment-section">
<div className="module-attachment-section__items"> <div className="module-attachment-section__items">

@ -33,17 +33,12 @@ export class SessionPasswordModal extends React.Component<Props, State> {
this.closeDialog = this.closeDialog.bind(this); this.closeDialog = this.closeDialog.bind(this);
this.onKeyUp = this.onKeyUp.bind(this); this.onKeyUp = this.onKeyUp.bind(this);
window.addEventListener('keyup', this.onKeyUp);
} }
public componentDidMount() { public componentDidMount() {
setTimeout(() => $('#password-modal-input').focus(), 100); setTimeout(() => $('#password-modal-input').focus(), 100);
} }
public componentWillUnmount() {
window.removeEventListener('keyup', this.onKeyUp);
}
public render() { public render() {
const { action, onOk } = this.props; const { action, onOk } = this.props;
const placeholders = const placeholders =
@ -69,6 +64,7 @@ export class SessionPasswordModal extends React.Component<Props, State> {
type="password" type="password"
id="password-modal-input" id="password-modal-input"
placeholder={placeholders[0]} placeholder={placeholders[0]}
onKeyUp={this.onKeyUp}
maxLength={window.CONSTANTS.MAX_PASSWORD_LENGTH} maxLength={window.CONSTANTS.MAX_PASSWORD_LENGTH}
/> />
{action !== PasswordAction.Remove && ( {action !== PasswordAction.Remove && (
@ -76,6 +72,7 @@ export class SessionPasswordModal extends React.Component<Props, State> {
type="password" type="password"
id="password-modal-input-confirm" id="password-modal-input-confirm"
placeholder={placeholders[1]} placeholder={placeholders[1]}
onKeyUp={this.onKeyUp}
maxLength={window.CONSTANTS.MAX_PASSWORD_LENGTH} maxLength={window.CONSTANTS.MAX_PASSWORD_LENGTH}
/> />
)} )}
@ -196,11 +193,8 @@ export class SessionPasswordModal extends React.Component<Props, State> {
private async onKeyUp(event: any) { private async onKeyUp(event: any) {
const { onOk } = this.props; const { onOk } = this.props;
const setPasswordFocussed =
$('#password-modal-input').is(':focus') ||
$('#password-modal-input-confirm').is(':focus');
if (event.key === 'Enter' && setPasswordFocussed) { if (event.key === 'Enter') {
await this.setPassword(onOk); await this.setPassword(onOk);
} }

@ -27,18 +27,12 @@ export class SessionPasswordPrompt extends React.PureComponent<{}, State> {
this.onKeyUp = this.onKeyUp.bind(this); this.onKeyUp = this.onKeyUp.bind(this);
this.initLogin = this.initLogin.bind(this); this.initLogin = this.initLogin.bind(this);
this.initClearDataView = this.initClearDataView.bind(this); this.initClearDataView = this.initClearDataView.bind(this);
window.addEventListener('keyup', this.onKeyUp);
} }
public componentDidMount() { public componentDidMount() {
setTimeout(() => $('#password-prompt-input').focus(), 100); setTimeout(() => $('#password-prompt-input').focus(), 100);
} }
public componentWillUnmount() {
window.removeEventListener('keyup', this.onKeyUp);
}
public render() { public render() {
const showResetElements = const showResetElements =
this.state.errorCount >= window.CONSTANTS.MAX_LOGIN_TRIES; this.state.errorCount >= window.CONSTANTS.MAX_LOGIN_TRIES;
@ -66,6 +60,7 @@ export class SessionPasswordPrompt extends React.PureComponent<{}, State> {
type="password" type="password"
defaultValue="" defaultValue=""
placeholder={' '} placeholder={' '}
onKeyUp={this.onKeyUp}
maxLength={window.CONSTANTS.MAX_PASSWORD_LENGTH} maxLength={window.CONSTANTS.MAX_PASSWORD_LENGTH}
/> />
); );

@ -36,8 +36,6 @@ export class SessionSeedModal extends React.Component<Props, State> {
this.confirmPassword = this.confirmPassword.bind(this); this.confirmPassword = this.confirmPassword.bind(this);
this.checkHasPassword = this.checkHasPassword.bind(this); this.checkHasPassword = this.checkHasPassword.bind(this);
this.onEnter = this.onEnter.bind(this); this.onEnter = this.onEnter.bind(this);
window.addEventListener('keyup', this.onEnter);
} }
public componentDidMount() { public componentDidMount() {
@ -88,6 +86,7 @@ export class SessionSeedModal extends React.Component<Props, State> {
type="password" type="password"
id="seed-input-password" id="seed-input-password"
placeholder={i18n('password')} placeholder={i18n('password')}
onKeyUp={this.onEnter}
maxLength={maxPasswordLen} maxLength={maxPasswordLen}
/> />
@ -222,9 +221,7 @@ export class SessionSeedModal extends React.Component<Props, State> {
private onEnter(event: any) { private onEnter(event: any) {
if (event.key === 'Enter') { if (event.key === 'Enter') {
if ($('#seed-input-password').is(':focus')) { this.confirmPassword();
this.confirmPassword();
}
} }
} }
} }

Loading…
Cancel
Save