[Glitch] Allow to open a modal for embedded photo

Port bf7757cbbc to glitch-soc
This commit is contained in:
Thibaut Girka
2018-04-08 23:06:33 +02:00
parent 3ab6a8b8be
commit 0b86ec4e7f
4 changed files with 37 additions and 7 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(() => {