mirror of
https://github.com/discourse/discourse.git
synced 2025-02-20 11:48:26 -06:00
Never bind the poster expansion twice.
This commit is contained in:
parent
c3c06ae8ea
commit
20cba4e092
@ -5,6 +5,9 @@
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
|
||||
var clickOutsideEventName = "mousedown.outside-poster-expansion";
|
||||
|
||||
Discourse.PosterExpansionView = Discourse.View.extend({
|
||||
elementId: 'poster-expansion',
|
||||
classNameBindings: ['controller.visible::hidden'],
|
||||
@ -29,7 +32,7 @@ Discourse.PosterExpansionView = Discourse.View.extend({
|
||||
|
||||
didInsertElement: function() {
|
||||
var self = this;
|
||||
$('html').on('mousedown.outside-poster-expansion', function(e) {
|
||||
$('html').off(clickOutsideEventName).on(clickOutsideEventName, function(e) {
|
||||
|
||||
if (self.get('controller.visible')) {
|
||||
var $target = $(e.target);
|
||||
@ -44,7 +47,7 @@ Discourse.PosterExpansionView = Discourse.View.extend({
|
||||
},
|
||||
|
||||
willDestroyElement: function() {
|
||||
$('html').off('mousedown.outside-poster-expansion');
|
||||
$('html').off(clickOutsideEventName);
|
||||
}
|
||||
|
||||
});
|
Loading…
Reference in New Issue
Block a user