replace the last @-moz-document if present in a usercss template
when creating a new style for the site via popup see #352
This commit is contained in:
parent
c5ef92cf9c
commit
4bb1a191cc
|
@ -123,7 +123,8 @@ function createSourceEditor(style) {
|
||||||
|
|
||||||
chromeSync.getLZValue('usercssTemplate').then(code => {
|
chromeSync.getLZValue('usercssTemplate').then(code => {
|
||||||
code = code || DEFAULT_CODE;
|
code = code || DEFAULT_CODE;
|
||||||
style.sourceCode = code.replace(/\s+$/, '\n\n') + 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;
|
||||||
cm.startOperation();
|
cm.startOperation();
|
||||||
cm.setValue(style.sourceCode);
|
cm.setValue(style.sourceCode);
|
||||||
cm.clearHistory();
|
cm.clearHistory();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user