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'));
cm.startOperation();
editors.push(cm);
updateMeta().then(() => {
initLint();
initLinterSwitch();
cm.setValue(style.sourceCode);
cm.clearHistory();
cm.markClean();
editors.push(cm);
cm.endOperation();
initHooks();
initAppliesToLineWidget();
@ -58,9 +59,6 @@ function createSourceEditor(style) {
cm.focus();
});
initLint();
initLinterSwitch();
function initAppliesToLineWidget() {
const PREF_NAME = 'editor.appliesToLineWidget';
const widget = createAppliesToLineWidget(cm);
@ -104,6 +102,7 @@ function createSourceEditor(style) {
update();
});
linterEl.addEventListener('change', update);
update();
function update() {
linterEl.value = linterConfig.getDefault();