From 229d4677701aa50fa6feebea2e3d791771f86482 Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 7 Mar 2018 07:23:47 -0800 Subject: [PATCH] Restore lightbox behavior for thumbnailed images Summary: Ref T13099. See . The Content-Security-Policy changes rewrote some of this code and the handling for "Download" links is incorrectly catching clicks on thumbnailed images. Test Plan: Clicked a thumbnailed image, got a lightbox. Command-clicked a download link, still got link behavior instead of a lightbox. Maniphest Tasks: T13099 Differential Revision: https://secure.phabricator.com/D19188 --- resources/celerity/map.php | 24 +++++++++---------- .../js/core/behavior-lightbox-attachments.js | 5 ++-- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index a6435d6afd..f4a855da99 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -10,7 +10,7 @@ return array( 'conpherence.pkg.css' => 'e68cf1fa', 'conpherence.pkg.js' => '15191c65', 'core.pkg.css' => '2fa91e14', - 'core.pkg.js' => 'a3ceffdb', + 'core.pkg.js' => 'e4d73c62', 'darkconsole.pkg.js' => '1f9a31bc', 'differential.pkg.css' => '113e692c', 'differential.pkg.js' => 'f6d809c0', @@ -494,7 +494,7 @@ return array( 'rsrc/js/core/behavior-hovercard.js' => 'bcaccd64', 'rsrc/js/core/behavior-keyboard-pager.js' => 'a8da01f0', 'rsrc/js/core/behavior-keyboard-shortcuts.js' => '01fca1f0', - 'rsrc/js/core/behavior-lightbox-attachments.js' => 'e31fad01', + 'rsrc/js/core/behavior-lightbox-attachments.js' => '562bcce0', 'rsrc/js/core/behavior-line-linker.js' => 'a9b946f8', 'rsrc/js/core/behavior-more.js' => 'a80d0378', 'rsrc/js/core/behavior-object-selector.js' => '77c1f0b0', @@ -643,7 +643,7 @@ return array( 'javelin-behavior-history-install' => '7ee2b591', 'javelin-behavior-icon-composer' => '8499b6ab', 'javelin-behavior-launch-icon-composer' => '48086888', - 'javelin-behavior-lightbox-attachments' => 'e31fad01', + 'javelin-behavior-lightbox-attachments' => '562bcce0', 'javelin-behavior-line-chart' => 'e4232876', 'javelin-behavior-load-blame' => '42126667', 'javelin-behavior-maniphest-batch-selector' => 'ad54037e', @@ -1362,6 +1362,15 @@ return array( 'javelin-vector', 'javelin-dom', ), + '562bcce0' => array( + 'javelin-behavior', + 'javelin-stratcom', + 'javelin-dom', + 'javelin-mask', + 'javelin-util', + 'phuix-icon-view', + 'phabricator-busy', + ), '58dea2fa' => array( 'javelin-install', 'javelin-util', @@ -2067,15 +2076,6 @@ return array( 'javelin-dom', 'phabricator-draggable-list', ), - 'e31fad01' => array( - 'javelin-behavior', - 'javelin-stratcom', - 'javelin-dom', - 'javelin-mask', - 'javelin-util', - 'phuix-icon-view', - 'phabricator-busy', - ), 'e379b58e' => array( 'javelin-behavior', 'javelin-stratcom', diff --git a/webroot/rsrc/js/core/behavior-lightbox-attachments.js b/webroot/rsrc/js/core/behavior-lightbox-attachments.js index eb31d22c60..cacec257b3 100644 --- a/webroot/rsrc/js/core/behavior-lightbox-attachments.js +++ b/webroot/rsrc/js/core/behavior-lightbox-attachments.js @@ -48,8 +48,9 @@ JX.behavior('lightbox-attachments', function() { } // If you click the "Download" link inside an embedded file element, - // don't lightbox the file. - if (e.getNode('tag:a')) { + // don't lightbox the file. But do lightbox when the user clicks an + // "" inside an "". + if (e.getNode('tag:a') && !e.getNode('tag:img')) { return; }