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