generalize can-close-on-esc

This commit is contained in:
tophf 2021-12-25 21:53:15 +03:00
parent 669fb443a9
commit a35405500e
2 changed files with 8 additions and 6 deletions

View File

@ -214,11 +214,11 @@
</template> </template>
<template data-id="keymapHelp"> <template data-id="keymapHelp">
<table class="keymap-list"> <table class="keymap-list can-close-on-esc">
<thead> <thead>
<tr> <tr>
<th><input i18n-placeholder="helpKeyMapHotkey" type="search" class="can-close-on-esc"></th> <th><input i18n-placeholder="helpKeyMapHotkey" type="search"></th>
<th><input i18n-placeholder="helpKeyMapCommand" type="search" class="can-close-on-esc" spellcheck="false"></th> <th><input i18n-placeholder="helpKeyMapCommand" type="search"></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -231,7 +231,7 @@
</template> </template>
<template data-id="styleSettings"> <template data-id="styleSettings">
<fieldset class="style-settings" disabled> <fieldset class="style-settings can-close-on-esc">
<!-- <label class="style-origin"> <!-- <label class="style-origin">
<span class="form-label" i18n-text="styleOriginLabel"></span> <span class="form-label" i18n-text="styleOriginLabel"></span>
<input id="styleOrigin" type="text"> <input id="styleOrigin" type="text">

View File

@ -31,8 +31,10 @@ const helpPopup = {
getEventKeyName(event) === 'Escape' && getEventKeyName(event) === 'Escape' &&
!$('.CodeMirror-hints, #message-box') && ( !$('.CodeMirror-hints, #message-box') && (
!document.activeElement || !document.activeElement ||
!document.activeElement.closest('#search-replace-dialog') && !document.activeElement.closest('#search-replace-dialog') && (
document.activeElement.matches(':not(input), .can-close-on-esc') document.activeElement.tagName !== 'INPUT' ||
document.activeElement.closest('.can-close-on-esc')
)
) )
); );
const div = $('#help-popup'); const div = $('#help-popup');