debounce indicateCodeChange per cm
This commit is contained in:
parent
0a5d9d86bf
commit
8809384264
|
@ -380,7 +380,7 @@ function setupCodeMirror(textarea, index) {
|
||||||
const cm = CodeMirror.fromTextArea(textarea, {lint: null});
|
const cm = CodeMirror.fromTextArea(textarea, {lint: null});
|
||||||
const wrapper = cm.display.wrapper;
|
const wrapper = cm.display.wrapper;
|
||||||
|
|
||||||
cm.on('changes', cm => debounce(indicateCodeChange, 200, cm));
|
cm.on('changes', indicateCodeChangeDebounced);
|
||||||
if (prefs.get('editor.autocompleteOnTyping')) {
|
if (prefs.get('editor.autocompleteOnTyping')) {
|
||||||
cm.on('changes', autocompleteOnTyping);
|
cm.on('changes', autocompleteOnTyping);
|
||||||
cm.on('pick', autocompletePicked);
|
cm.on('pick', autocompletePicked);
|
||||||
|
@ -469,6 +469,11 @@ function indicateCodeChange(cm) {
|
||||||
updateLintReportIfEnabled(cm);
|
updateLintReportIfEnabled(cm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function indicateCodeChangeDebounced(cm, ...args) {
|
||||||
|
clearTimeout(cm.state.stylusOnChangeTimer);
|
||||||
|
cm.state.stylusOnChangeTimer = setTimeout(indicateCodeChange, 200, cm, ...args);
|
||||||
|
}
|
||||||
|
|
||||||
function getSectionForChild(e) {
|
function getSectionForChild(e) {
|
||||||
return e.closest('#sections > div');
|
return e.closest('#sections > div');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user