diff --git a/edit/linter.js b/edit/linter.js index ae4ff657..8e0954c7 100644 --- a/edit/linter.js +++ b/edit/linter.js @@ -10,8 +10,8 @@ var linter = (() => { return { register, refresh, - hook, - unhook, + enableForEditor, + disableForEditor, onChange, onUnhook }; @@ -30,12 +30,12 @@ var linter = (() => { } } - function hook(cm) { + function enableForEditor(cm) { cm.setOption('lint', {onUpdateLinting, getAnnotations}); cms.add(cm); } - function unhook(cm) { + function disableForEditor(cm) { cm.setOption('lint', false); cms.delete(cm); for (const cb of unhookCallbacks) { diff --git a/edit/sections.js b/edit/sections.js index a37a37ba..acc7fc26 100644 --- a/edit/sections.js +++ b/edit/sections.js @@ -151,7 +151,7 @@ function addSection(event, section) { sections.appendChild(div); cm = setupCodeMirror(div, code); } - linter.hook(cm); + linter.enableForEditor(cm); linterReport.refresh(); div.CodeMirror = cm; setCleanSection(div); @@ -481,7 +481,7 @@ function removeSection(event) { setCleanItem(section, false); updateTitle(); cm.focus(); - linter.hook(cm); + linter.enableForEditor(cm); linterReport.refresh(); }; section.insertAdjacentElement('afterend', stub); @@ -489,7 +489,7 @@ function removeSection(event) { setCleanItem($('#sections'), false); removeAreaAndSetDirty(section); editors.splice(editors.indexOf(cm), 1); - linter.unhook(cm); + linter.disableForEditor(cm); linterReport.refresh(); } diff --git a/edit/source-editor.js b/edit/source-editor.js index d9e3d4f3..5464f9a1 100644 --- a/edit/source-editor.js +++ b/edit/source-editor.js @@ -62,7 +62,7 @@ function createSourceEditor(style) { updateMeta(); }); - linter.hook(cm); + linter.enableForEditor(cm); updateMeta().then(() => {