deduplicate usage of #help-popup id

This commit is contained in:
tophf 2021-12-26 13:12:36 +03:00
parent 40abc64c2c
commit c950abfc57
2 changed files with 4 additions and 3 deletions

View File

@ -65,7 +65,7 @@ function beautifyEditor(cm, options, ui) {
window.scrollTo(scrollX, scrollY);
cm.beautifyChange[cm.changeGeneration()] = true;
if (ui) {
$('#help-popup button[role="close"]').disabled = false;
$('button[role="close"]', helpPopup.div).disabled = false;
}
}
}
@ -87,7 +87,7 @@ function createBeautifyUI(scope, options) {
$create('span', t('styleBeautifyHint') + '\u00A0'),
createHotkeyInput('editor.beautify.hotkey', {
buttons: false,
onDone: () => moveFocus($('#help-popup'), 0),
onDone: () => moveFocus(helpPopup.div, 0),
}),
]),
$create('.buttons', [

View File

@ -28,6 +28,7 @@ const helpPopup = {
window.on('keydown', helpPopup.close, true);
div.style.display = 'block';
helpPopup.originalFocus = document.activeElement;
helpPopup.div = div;
return div;
},
@ -44,7 +45,7 @@ const helpPopup = {
)
)
);
const div = $('#help-popup');
const {div} = helpPopup;
if (!canClose || !div) {
return;
}