dedupe linter.enableForEditor calls

This commit is contained in:
tophf 2020-11-13 19:02:33 +03:00
parent 184b6d4f7c
commit a06697808f
3 changed files with 1 additions and 2 deletions

View File

@ -89,6 +89,7 @@ lazyInit();
dirty.onChange(updateDirty); dirty.onChange(updateDirty);
await editor.ready; await editor.ready;
setTimeout(() => editor.getEditors().forEach(linter.enableForEditor));
// enabling after init to prevent flash of validation failure on an empty name // enabling after init to prevent flash of validation failure on an empty name
$('#name').required = !editor.isUsercss; $('#name').required = !editor.isUsercss;
$('#save-button').onclick = editor.save; $('#save-button').onclick = editor.save;

View File

@ -517,7 +517,6 @@ function SectionsEditor() {
if (!originalSections.length) { if (!originalSections.length) {
setGlobalProgress(); setGlobalProgress();
requestAnimationFrame(fitToAvailableSpace); requestAnimationFrame(fitToAvailableSpace);
sections.forEach(({cm}) => setTimeout(linter.enableForEditor, 0, cm));
done(); done();
} else { } else {
setTimeout(chunk); setTimeout(chunk);

View File

@ -90,7 +90,6 @@ function SourceEditor() {
linter.run(); linter.run();
updateLinterSwitch(); updateLinterSwitch();
}); });
debounce(linter.enableForEditor, 0, cm);
if (!$.isTextInput(document.activeElement)) { if (!$.isTextInput(document.activeElement)) {
cm.focus(); cm.focus();
} }