0
0
Fork 0

Allow to open a modal for embedded photo (#5777)

This commit is contained in:
Akihiko Odaki 2017-11-25 23:41:45 +09:00 committed by Eugen Rochko
parent 1266c66f79
commit bf7757cbbc
5 changed files with 41 additions and 14 deletions

View file

@ -7,7 +7,7 @@ export default class ImageLoader extends React.PureComponent {
static propTypes = {
alt: PropTypes.string,
src: PropTypes.string.isRequired,
previewSrc: PropTypes.string.isRequired,
previewSrc: PropTypes.string,
width: PropTypes.number,
height: PropTypes.number,
}
@ -47,7 +47,7 @@ export default class ImageLoader extends React.PureComponent {
this.removeEventListeners();
this.setState({ loading: true, error: false });
Promise.all([
this.loadPreviewCanvas(props),
props.previewSrc && this.loadPreviewCanvas(props),
this.hasSize() && this.loadOriginalImage(props),
].filter(Boolean))
.then(() => {