mirror of
https://github.com/discourse/discourse.git
synced 2025-03-09 14:34:35 +00:00
Escape key closes share dialog
This commit is contained in:
parent
36269cfbaa
commit
55884e4b77
@ -36,7 +36,7 @@ Discourse.ShareView = Discourse.View.extend({
|
|||||||
_this.get('controller').close();
|
_this.get('controller').close();
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
return $('html').on('click.discoure-share-link', '[data-share-url]', function(e) {
|
$('html').on('click.discoure-share-link', '[data-share-url]', function(e) {
|
||||||
var $currentTarget, url;
|
var $currentTarget, url;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
$currentTarget = $(e.currentTarget);
|
$currentTarget = $(e.currentTarget);
|
||||||
@ -50,11 +50,17 @@ Discourse.ShareView = Discourse.View.extend({
|
|||||||
_this.get('controller').shareLink(e, url);
|
_this.get('controller').shareLink(e, url);
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
$('html').on('keydown.shareView', function(e){
|
||||||
|
if (e.keyCode === 27) {
|
||||||
|
_this.get('controller').close();
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
willDestroyElement: function() {
|
willDestroyElement: function() {
|
||||||
$('html').off('click.discoure-share-link');
|
$('html').off('click.discoure-share-link');
|
||||||
$('html').off('click.outside-share-link');
|
$('html').off('click.outside-share-link');
|
||||||
|
$('html').off('keydown.shareView');
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user