Fix stylelint error message timer
This commit is contained in:
parent
7c5b4c2bcf
commit
dded798ee3
|
@ -1902,7 +1902,9 @@ function showHelp(title, body) {
|
||||||
((e.keyCode || e.which) === 27 && !e.altKey && !e.ctrlKey && !e.shiftKey && !e.metaKey)
|
((e.keyCode || e.which) === 27 && !e.altKey && !e.ctrlKey && !e.shiftKey && !e.metaKey)
|
||||||
) {
|
) {
|
||||||
div.style.display = '';
|
div.style.display = '';
|
||||||
document.querySelector('.contents').textContent = '';
|
const contents = $('.contents');
|
||||||
|
contents.textContent = '';
|
||||||
|
clearTimeout(contents.timer);
|
||||||
document.removeEventListener('keydown', closeHelp);
|
document.removeEventListener('keydown', closeHelp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -216,7 +216,6 @@ function showLintHelp() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function setupStylelintSettingsEvents(popup) {
|
function setupStylelintSettingsEvents(popup) {
|
||||||
let timer;
|
|
||||||
popup.querySelector('.save').addEventListener('click', event => {
|
popup.querySelector('.save').addEventListener('click', event => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
const json = tryJSONparse(popup.codebox.getValue());
|
const json = tryJSONparse(popup.codebox.getValue());
|
||||||
|
@ -228,8 +227,8 @@ function setupStylelintSettingsEvents(popup) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$('#help-popup .error').classList.add('show');
|
$('#help-popup .error').classList.add('show');
|
||||||
clearTimeout(timer);
|
clearTimeout($('#help-popup .contents').timer);
|
||||||
timer = setTimeout(() => {
|
$('#help-popup .contents').timer = setTimeout(() => {
|
||||||
// popup may be closed at this point
|
// popup may be closed at this point
|
||||||
const error = $('#help-popup .error');
|
const error = $('#help-popup .error');
|
||||||
if (error) {
|
if (error) {
|
||||||
|
@ -267,7 +266,6 @@ function setupStylelintPopup(rules) {
|
||||||
cm.setOption('lint', 'json');
|
cm.setOption('lint', 'json');
|
||||||
}
|
}
|
||||||
const popup = showCodeMirrorPopup(t('setStylelintRules'), $element({
|
const popup = showCodeMirrorPopup(t('setStylelintRules'), $element({
|
||||||
className: 'contents',
|
|
||||||
appendChild: [
|
appendChild: [
|
||||||
$element({
|
$element({
|
||||||
tag: 'p',
|
tag: 'p',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user