From 4c5fe6a6061c8631e8dd03cf3959f0b254a13b9e Mon Sep 17 00:00:00 2001 From: Bartholomew Date: Wed, 28 Aug 2019 23:27:48 +0100 Subject: [PATCH] fix(media-library): no render of non-viewable files (#2546) --- .../components/MediaLibrary/MediaLibraryCard.js | 14 ++++++++++++-- .../MediaLibrary/MediaLibraryCardGrid.js | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/packages/netlify-cms-core/src/components/MediaLibrary/MediaLibraryCard.js b/packages/netlify-cms-core/src/components/MediaLibrary/MediaLibraryCard.js index c78e4d9f..d9b5bb27 100644 --- a/packages/netlify-cms-core/src/components/MediaLibrary/MediaLibraryCard.js +++ b/packages/netlify-cms-core/src/components/MediaLibrary/MediaLibraryCard.js @@ -55,7 +55,17 @@ const CardText = styled.p` class MediaLibraryCard extends React.Component { render() { - const { isSelected, displayURL, text, onClick, width, margin, isPrivate, type } = this.props; + const { + isSelected, + displayURL, + text, + onClick, + width, + margin, + isPrivate, + type, + isViewableImage, + } = this.props; const url = displayURL.get('url'); return ( - {url ? : {type}} + {url && isViewableImage ? : {type}} {text} diff --git a/packages/netlify-cms-core/src/components/MediaLibrary/MediaLibraryCardGrid.js b/packages/netlify-cms-core/src/components/MediaLibrary/MediaLibraryCardGrid.js index a2c3128e..404e9207 100644 --- a/packages/netlify-cms-core/src/components/MediaLibrary/MediaLibraryCardGrid.js +++ b/packages/netlify-cms-core/src/components/MediaLibrary/MediaLibraryCardGrid.js @@ -52,6 +52,7 @@ const MediaLibraryCardGrid = ({ displayURL={displayURLs.get(file.id, file.url ? Map({ url: file.url }) : Map())} loadDisplayURL={() => loadDisplayURL(file)} type={file.type} + isViewableImage={file.isViewableImage} /> ))} {!canLoadMore ? null : }