Close modal with escape key
This commit is contained in:
parent
bc958a3f7b
commit
c9e3c1a55c
1 changed files with 10 additions and 0 deletions
|
@ -1513,6 +1513,16 @@ weechat.directive('inputBar', function() {
|
||||||
// Double-tap Escape -> disconnect
|
// Double-tap Escape -> disconnect
|
||||||
if (code === 27) {
|
if (code === 27) {
|
||||||
$event.preventDefault();
|
$event.preventDefault();
|
||||||
|
|
||||||
|
// Check if a modal is visible. If so, close it instead of disconnecting
|
||||||
|
var modals = document.querySelectorAll('.gb-modal');
|
||||||
|
for (var modalId in modals) {
|
||||||
|
if (modals[modalId].getAttribute('data-state') === 'visible') {
|
||||||
|
modals[modalId].setAttribute('data-state', 'hidden');
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (typeof $scope.lastEscape !== "undefined" && (Date.now() - $scope.lastEscape) <= 500) {
|
if (typeof $scope.lastEscape !== "undefined" && (Date.now() - $scope.lastEscape) <= 500) {
|
||||||
// Double-tap
|
// Double-tap
|
||||||
connection.disconnect();
|
connection.disconnect();
|
||||||
|
|
Loading…
Reference in a new issue