Fix: hook/unhook -> enableForEditor/disableForEditor
This commit is contained in:
parent
47c6834331
commit
0482ac5ee0
|
@ -10,8 +10,8 @@ var linter = (() => {
|
||||||
return {
|
return {
|
||||||
register,
|
register,
|
||||||
refresh,
|
refresh,
|
||||||
hook,
|
enableForEditor,
|
||||||
unhook,
|
disableForEditor,
|
||||||
onChange,
|
onChange,
|
||||||
onUnhook
|
onUnhook
|
||||||
};
|
};
|
||||||
|
@ -30,12 +30,12 @@ var linter = (() => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function hook(cm) {
|
function enableForEditor(cm) {
|
||||||
cm.setOption('lint', {onUpdateLinting, getAnnotations});
|
cm.setOption('lint', {onUpdateLinting, getAnnotations});
|
||||||
cms.add(cm);
|
cms.add(cm);
|
||||||
}
|
}
|
||||||
|
|
||||||
function unhook(cm) {
|
function disableForEditor(cm) {
|
||||||
cm.setOption('lint', false);
|
cm.setOption('lint', false);
|
||||||
cms.delete(cm);
|
cms.delete(cm);
|
||||||
for (const cb of unhookCallbacks) {
|
for (const cb of unhookCallbacks) {
|
||||||
|
|
|
@ -151,7 +151,7 @@ function addSection(event, section) {
|
||||||
sections.appendChild(div);
|
sections.appendChild(div);
|
||||||
cm = setupCodeMirror(div, code);
|
cm = setupCodeMirror(div, code);
|
||||||
}
|
}
|
||||||
linter.hook(cm);
|
linter.enableForEditor(cm);
|
||||||
linterReport.refresh();
|
linterReport.refresh();
|
||||||
div.CodeMirror = cm;
|
div.CodeMirror = cm;
|
||||||
setCleanSection(div);
|
setCleanSection(div);
|
||||||
|
@ -481,7 +481,7 @@ function removeSection(event) {
|
||||||
setCleanItem(section, false);
|
setCleanItem(section, false);
|
||||||
updateTitle();
|
updateTitle();
|
||||||
cm.focus();
|
cm.focus();
|
||||||
linter.hook(cm);
|
linter.enableForEditor(cm);
|
||||||
linterReport.refresh();
|
linterReport.refresh();
|
||||||
};
|
};
|
||||||
section.insertAdjacentElement('afterend', stub);
|
section.insertAdjacentElement('afterend', stub);
|
||||||
|
@ -489,7 +489,7 @@ function removeSection(event) {
|
||||||
setCleanItem($('#sections'), false);
|
setCleanItem($('#sections'), false);
|
||||||
removeAreaAndSetDirty(section);
|
removeAreaAndSetDirty(section);
|
||||||
editors.splice(editors.indexOf(cm), 1);
|
editors.splice(editors.indexOf(cm), 1);
|
||||||
linter.unhook(cm);
|
linter.disableForEditor(cm);
|
||||||
linterReport.refresh();
|
linterReport.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ function createSourceEditor(style) {
|
||||||
updateMeta();
|
updateMeta();
|
||||||
});
|
});
|
||||||
|
|
||||||
linter.hook(cm);
|
linter.enableForEditor(cm);
|
||||||
|
|
||||||
updateMeta().then(() => {
|
updateMeta().then(() => {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user