Revert "Fix #795: Close lightbox only if buttons, ESC key or the X icon is pressed"

This reverts commit 54cbfd9c92.
stable
Jesús Espino 2014-08-27 15:33:47 +02:00
parent 77558bb43c
commit a367787f26
1 changed files with 6 additions and 1 deletions

View File

@ -31,6 +31,11 @@ class LightboxService extends taiga.Service
lightbox.addClass('open') lightbox.addClass('open')
), 70 ), 70
lightbox.on 'click', (e) =>
target = angular.element(e.target)
if target[0] == lightbox[0]
@close(lightbox)
$(document) $(document)
.on 'keydown.lightbox', (e) => .on 'keydown.lightbox', (e) =>
code = if e.keyCode then e.keyCode else e.which code = if e.keyCode then e.keyCode else e.which
@ -38,6 +43,7 @@ class LightboxService extends taiga.Service
if code == 27 if code == 27
@close(lightbox) @close(lightbox)
close: (lightbox) -> close: (lightbox) ->
$(document).off('.lightbox') $(document).off('.lightbox')
lightbox lightbox
@ -47,7 +53,6 @@ class LightboxService extends taiga.Service
module.service("lightboxService", LightboxService) module.service("lightboxService", LightboxService)
LightboxDirective = (lightboxService) -> LightboxDirective = (lightboxService) ->
link = ($scope, $el, $attrs) -> link = ($scope, $el, $attrs) ->
$el.on "click", ".close", (event) -> $el.on "click", ".close", (event) ->