From a06697808f6736dfff34eeafa8d2b6043f43cde3 Mon Sep 17 00:00:00 2001 From: tophf Date: Fri, 13 Nov 2020 19:02:33 +0300 Subject: [PATCH] dedupe linter.enableForEditor calls --- edit/edit.js | 1 + edit/sections-editor.js | 1 - edit/source-editor.js | 1 - 3 files changed, 1 insertion(+), 2 deletions(-) diff --git a/edit/edit.js b/edit/edit.js index 02755ce9..d86adc92 100644 --- a/edit/edit.js +++ b/edit/edit.js @@ -89,6 +89,7 @@ lazyInit(); dirty.onChange(updateDirty); await editor.ready; + setTimeout(() => editor.getEditors().forEach(linter.enableForEditor)); // enabling after init to prevent flash of validation failure on an empty name $('#name').required = !editor.isUsercss; $('#save-button').onclick = editor.save; diff --git a/edit/sections-editor.js b/edit/sections-editor.js index 1279845b..6f71e83d 100644 --- a/edit/sections-editor.js +++ b/edit/sections-editor.js @@ -517,7 +517,6 @@ function SectionsEditor() { if (!originalSections.length) { setGlobalProgress(); requestAnimationFrame(fitToAvailableSpace); - sections.forEach(({cm}) => setTimeout(linter.enableForEditor, 0, cm)); done(); } else { setTimeout(chunk); diff --git a/edit/source-editor.js b/edit/source-editor.js index 972138a3..eaa95e7b 100644 --- a/edit/source-editor.js +++ b/edit/source-editor.js @@ -90,7 +90,6 @@ function SourceEditor() { linter.run(); updateLinterSwitch(); }); - debounce(linter.enableForEditor, 0, cm); if (!$.isTextInput(document.activeElement)) { cm.focus(); }