diff options
author | Thibaut Girka <thib@sitedethib.com> | 2018-04-08 23:06:33 +0200 |
---|---|---|
committer | Thibaut Girka <thib@sitedethib.com> | 2018-04-08 23:06:33 +0200 |
commit | 0b86ec4e7fb45c1388a692b23f5ffc7d78b5076f (patch) | |
tree | 15fc5f0503dcc402a36f93fce7432db8a8db9472 /app/javascript/flavours/glitch/features/ui | |
parent | 3ab6a8b8bed37d048909b178693af8411325eb38 (diff) |
[Glitch] Allow to open a modal for embedded photo
Port bf7757cbbc7677fb46aee9a0a8d1b8a37ded7bb6 to glitch-soc
Diffstat (limited to 'app/javascript/flavours/glitch/features/ui')
-rw-r--r-- | app/javascript/flavours/glitch/features/ui/components/image_loader.js | 4 | ||||
-rw-r--r-- | app/javascript/flavours/glitch/features/ui/components/media_modal.js | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/app/javascript/flavours/glitch/features/ui/components/image_loader.js b/app/javascript/flavours/glitch/features/ui/components/image_loader.js index aad594380..e3e7197c5 100644 --- a/app/javascript/flavours/glitch/features/ui/components/image_loader.js +++ b/app/javascript/flavours/glitch/features/ui/components/image_loader.js @@ -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(() => { diff --git a/app/javascript/flavours/glitch/features/ui/components/media_modal.js b/app/javascript/flavours/glitch/features/ui/components/media_modal.js index e56147c5b..26c7e9ebc 100644 --- a/app/javascript/flavours/glitch/features/ui/components/media_modal.js +++ b/app/javascript/flavours/glitch/features/ui/components/media_modal.js @@ -92,7 +92,7 @@ export default class MediaModal extends ImmutablePureComponent { const height = image.getIn(['meta', 'original', 'height']) || null; if (image.get('type') === 'image') { - return <ImageLoader previewSrc={image.get('preview_url')} src={image.get('url')} width={width} height={height} alt={image.get('description')} key={image.get('preview_url')} />; + return <ImageLoader previewSrc={image.get('preview_url')} src={image.get('url')} width={width} height={height} alt={image.get('description')} key={image.get('url')} />; } else if (image.get('type') === 'gifv') { return <ExtendedVideoPlayer src={image.get('url')} muted controls={false} width={width} height={height} key={image.get('preview_url')} alt={image.get('description')} />; } |