init CM to usercss @preprocessor before setting the code

This commit is contained in:
tophf 2017-11-22 16:28:27 +03:00
parent 0ed6e3d4bf
commit e1fae23927

View File

@ -43,13 +43,14 @@ function createSourceEditor(style) {
} }
const cm = CodeMirror.fromTextArea($('#sections textarea')); const cm = CodeMirror.fromTextArea($('#sections textarea'));
cm.startOperation(); editors.push(cm);
updateMeta().then(() => { updateMeta().then(() => {
initLint();
initLinterSwitch();
cm.setValue(style.sourceCode); cm.setValue(style.sourceCode);
cm.clearHistory(); cm.clearHistory();
cm.markClean(); cm.markClean();
editors.push(cm);
cm.endOperation();
initHooks(); initHooks();
initAppliesToLineWidget(); initAppliesToLineWidget();
@ -58,9 +59,6 @@ function createSourceEditor(style) {
cm.focus(); cm.focus();
}); });
initLint();
initLinterSwitch();
function initAppliesToLineWidget() { function initAppliesToLineWidget() {
const PREF_NAME = 'editor.appliesToLineWidget'; const PREF_NAME = 'editor.appliesToLineWidget';
const widget = createAppliesToLineWidget(cm); const widget = createAppliesToLineWidget(cm);
@ -104,6 +102,7 @@ function createSourceEditor(style) {
update(); update();
}); });
linterEl.addEventListener('change', update); linterEl.addEventListener('change', update);
update();
function update() { function update() {
linterEl.value = linterConfig.getDefault(); linterEl.value = linterConfig.getDefault();