Implement Jira Ticket PLT-6555 - Enter should confirm deletion on delete modals (#6375)
Этот коммит содержится в:
коммит произвёл
Harrison Healey
родитель
a5d2d6503d
Коммит
d07e4068b4
@@ -11,12 +11,14 @@ import {browserHistory} from 'react-router/es6';
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import {deleteChannel} from 'actions/channel_actions.jsx';
|
import {deleteChannel} from 'actions/channel_actions.jsx';
|
||||||
|
import Constants from 'utils/constants.jsx';
|
||||||
|
|
||||||
export default class DeleteChannelModal extends React.Component {
|
export default class DeleteChannelModal extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
this.handleDelete = this.handleDelete.bind(this);
|
this.handleDelete = this.handleDelete.bind(this);
|
||||||
|
this.handleKeyDown = this.handleKeyDown.bind(this);
|
||||||
this.onHide = this.onHide.bind(this);
|
this.onHide = this.onHide.bind(this);
|
||||||
|
|
||||||
this.state = {show: true};
|
this.state = {show: true};
|
||||||
@@ -35,12 +37,19 @@ export default class DeleteChannelModal extends React.Component {
|
|||||||
this.setState({show: false});
|
this.setState({show: false});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleKeyDown(e) {
|
||||||
|
if (e.keyCode === Constants.KeyCodes.ENTER) {
|
||||||
|
this.handleDelete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
show={this.state.show}
|
show={this.state.show}
|
||||||
onHide={this.onHide}
|
onHide={this.onHide}
|
||||||
onExited={this.props.onHide}
|
onExited={this.props.onHide}
|
||||||
|
onKeyDown={this.handleKeyDown}
|
||||||
>
|
>
|
||||||
<Modal.Header closeButton={true}>
|
<Modal.Header closeButton={true}>
|
||||||
<h4 className='modal-title'>
|
<h4 className='modal-title'>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import ConfirmModal from './confirm_modal.jsx';
|
import ConfirmModal from './confirm_modal.jsx';
|
||||||
|
import Constants from 'utils/constants.jsx';
|
||||||
|
|
||||||
export default class DeleteModalTrigger extends React.Component {
|
export default class DeleteModalTrigger extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
@@ -11,6 +12,7 @@ export default class DeleteModalTrigger extends React.Component {
|
|||||||
this.handleConfirm = this.handleConfirm.bind(this);
|
this.handleConfirm = this.handleConfirm.bind(this);
|
||||||
this.handleCancel = this.handleCancel.bind(this);
|
this.handleCancel = this.handleCancel.bind(this);
|
||||||
this.handleOpenModal = this.handleOpenModal.bind(this);
|
this.handleOpenModal = this.handleOpenModal.bind(this);
|
||||||
|
this.handleKeyDown = this.handleKeyDown.bind(this);
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
showDeleteModal: false
|
showDeleteModal: false
|
||||||
@@ -35,6 +37,12 @@ export default class DeleteModalTrigger extends React.Component {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleKeyDown(e) {
|
||||||
|
if (e.keyCode === Constants.KeyCodes.ENTER) {
|
||||||
|
this.handleConfirm(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<span>
|
<span>
|
||||||
@@ -51,6 +59,7 @@ export default class DeleteModalTrigger extends React.Component {
|
|||||||
confirmButton={this.modalConfirmButton}
|
confirmButton={this.modalConfirmButton}
|
||||||
onConfirm={this.handleConfirm}
|
onConfirm={this.handleConfirm}
|
||||||
onCancel={this.handleCancel}
|
onCancel={this.handleCancel}
|
||||||
|
onKeyDown={this.handleKeyDown}
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -26,9 +26,7 @@ export default class EmojiListItem extends React.Component {
|
|||||||
this.handleDelete = this.handleDelete.bind(this);
|
this.handleDelete = this.handleDelete.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleDelete(e) {
|
handleDelete() {
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
this.props.onDelete(this.props.emoji);
|
this.props.onDelete(this.props.emoji);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user