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."
},
"deletePublicChannelConfirmation": {
"message": "Leave this public channel?",
"message": "Leave this Open Group?",
"description":
"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 {
@include session-color-subtle($session-color-white);
font-family: "SF Pro Text";
font-family: 'SF Pro Text';
font-weight: 300;
}

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

@ -15,9 +15,9 @@ interface Props {
}
export class AttachmentSection extends React.Component<Props> {
public render() {
public render() {
const { type } = this.props;
return (
<div className="module-attachment-section">
<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.onKeyUp = this.onKeyUp.bind(this);
window.addEventListener('keyup', this.onKeyUp);
}
public componentDidMount() {
setTimeout(() => $('#password-modal-input').focus(), 100);
}
public componentWillUnmount() {
window.removeEventListener('keyup', this.onKeyUp);
}
public render() {
const { action, onOk } = this.props;
const placeholders =
@ -69,6 +64,7 @@ export class SessionPasswordModal extends React.Component<Props, State> {
type="password"
id="password-modal-input"
placeholder={placeholders[0]}
onKeyUp={this.onKeyUp}
maxLength={window.CONSTANTS.MAX_PASSWORD_LENGTH}
/>
{action !== PasswordAction.Remove && (
@ -76,6 +72,7 @@ export class SessionPasswordModal extends React.Component<Props, State> {
type="password"
id="password-modal-input-confirm"
placeholder={placeholders[1]}
onKeyUp={this.onKeyUp}
maxLength={window.CONSTANTS.MAX_PASSWORD_LENGTH}
/>
)}
@ -196,11 +193,8 @@ export class SessionPasswordModal extends React.Component<Props, State> {
private async onKeyUp(event: any) {
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);
}

@ -27,18 +27,12 @@ export class SessionPasswordPrompt extends React.PureComponent<{}, State> {
this.onKeyUp = this.onKeyUp.bind(this);
this.initLogin = this.initLogin.bind(this);
this.initClearDataView = this.initClearDataView.bind(this);
window.addEventListener('keyup', this.onKeyUp);
}
public componentDidMount() {
setTimeout(() => $('#password-prompt-input').focus(), 100);
}
public componentWillUnmount() {
window.removeEventListener('keyup', this.onKeyUp);
}
public render() {
const showResetElements =
this.state.errorCount >= window.CONSTANTS.MAX_LOGIN_TRIES;
@ -66,6 +60,7 @@ export class SessionPasswordPrompt extends React.PureComponent<{}, State> {
type="password"
defaultValue=""
placeholder={' '}
onKeyUp={this.onKeyUp}
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.checkHasPassword = this.checkHasPassword.bind(this);
this.onEnter = this.onEnter.bind(this);
window.addEventListener('keyup', this.onEnter);
}
public componentDidMount() {
@ -88,6 +86,7 @@ export class SessionSeedModal extends React.Component<Props, State> {
type="password"
id="seed-input-password"
placeholder={i18n('password')}
onKeyUp={this.onEnter}
maxLength={maxPasswordLen}
/>
@ -222,9 +221,7 @@ export class SessionSeedModal extends React.Component<Props, State> {
private onEnter(event: any) {
if (event.key === 'Enter') {
if ($('#seed-input-password').is(':focus')) {
this.confirmPassword();
}
this.confirmPassword();
}
}
}

Loading…
Cancel
Save