From e1fae23927967ae1e121bea85d43f9f97f17019a Mon Sep 17 00:00:00 2001 From: tophf Date: Wed, 22 Nov 2017 16:28:27 +0300 Subject: [PATCH] init CM to usercss @preprocessor before setting the code --- edit/source-editor.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/edit/source-editor.js b/edit/source-editor.js index 5cdd60d2..3f7d51f2 100644 --- a/edit/source-editor.js +++ b/edit/source-editor.js @@ -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();