From cfadb9f4fd99c99278cc9f74d2d497ce4de7e89b Mon Sep 17 00:00:00 2001 From: Charles Hacskaylo Date: Thu, 30 Apr 2020 09:48:16 -0700 Subject: [PATCH] Fixes #2901 (#2902) - Mod PreviewAction to prevent folders from being previewed; Co-authored-by: Andrew Henry --- src/ui/preview/PreviewAction.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ui/preview/PreviewAction.js b/src/ui/preview/PreviewAction.js index 2310a6aca1..80ae046bd3 100644 --- a/src/ui/preview/PreviewAction.js +++ b/src/ui/preview/PreviewAction.js @@ -63,7 +63,7 @@ export default class PreviewAction { }); } appliesTo(objectPath) { - return !this._isNavigatedObject(objectPath) + return !this._isNavigatedObject(objectPath) && !this._preventPreview(objectPath); } _isNavigatedObject(objectPath) { let targetObject = objectPath[0]; @@ -71,4 +71,8 @@ export default class PreviewAction { return targetObject.identifier.namespace === navigatedObject.identifier.namespace && targetObject.identifier.key === navigatedObject.identifier.key; } + _preventPreview(objectPath) { + const noPreviewTypes = ['folder']; + return noPreviewTypes.includes(objectPath[0].type); + } }