fixed bug to select preview images.

This commit is contained in:
Yoshihiro OKUMURA
2019-06-27 10:35:08 +09:00
parent adc9a8e5ed
commit cbc22c5546
+2 -2
View File
@@ -35,7 +35,7 @@ class Preview extends Component<Props, State> {
return null;
}
let imageUrls: string[] = [];
const previews = data.map((value) => {
const previews = data.map((value, idx) => {
const fileUrl = ItemUtil.getFileUrl(value);
const previewUrl = ItemUtil.getPreviewFileUrl(value);
const caption = Functions.mlang(value.caption, lang);
@@ -44,7 +44,7 @@ class Preview extends Component<Props, State> {
<figure key={value.file_id} className={styles.preview}>
<a href={fileUrl} download={value.original_file_name} onClick={(e) => {
e.preventDefault();
this.setState({ isOpen: true });
this.setState({ isOpen: true, imageIndex: idx });
}}>
<img src={previewUrl} alt={caption} />
</a>