fixup: add the empty line correctly

This commit is contained in:
tophf 2018-02-22 18:34:15 +03:00
parent 4bb1a191cc
commit 4e4f0501d2

View File

@ -124,7 +124,7 @@ function createSourceEditor(style) {
chromeSync.getLZValue('usercssTemplate').then(code => { chromeSync.getLZValue('usercssTemplate').then(code => {
code = code || DEFAULT_CODE; code = code || DEFAULT_CODE;
// strip the last dummy section if any, add an empty line followed by the section // strip the last dummy section if any, add an empty line followed by the section
style.sourceCode = code.replace(/@-moz-document[^{]*\{[^}]*\}\s*$|\s+$/g, '\n\n') + section; style.sourceCode = code.replace(/@-moz-document[^{]*\{[^}]*\}\s*$|\s+$/g, '') + '\n\n' + section;
cm.startOperation(); cm.startOperation();
cm.setValue(style.sourceCode); cm.setValue(style.sourceCode);
cm.clearHistory(); cm.clearHistory();