Merge pull request #784 from mattermost/img-modal-fix

Fixing arrow keys in preview image modal
Этот коммит содержится в:
Harrison Healey
2015-09-24 12:53:14 -04:00
родитель 6c0d094d13 7efacb09bf
Коммит 627e4f1c2b

Просмотреть файл

@@ -40,7 +40,9 @@ export default class ViewImageModal extends React.Component {
}; };
} }
handleNext(e) { handleNext(e) {
if (e) {
e.stopPropagation(); e.stopPropagation();
}
var id = this.state.imgId + 1; var id = this.state.imgId + 1;
if (id > this.props.filenames.length - 1) { if (id > this.props.filenames.length - 1) {
id = 0; id = 0;
@@ -49,7 +51,9 @@ export default class ViewImageModal extends React.Component {
this.loadImage(id); this.loadImage(id);
} }
handlePrev(e) { handlePrev(e) {
if (e) {
e.stopPropagation(); e.stopPropagation();
}
var id = this.state.imgId - 1; var id = this.state.imgId - 1;
if (id < 0) { if (id < 0) {
id = this.props.filenames.length - 1; id = this.props.filenames.length - 1;