strip more trailing spaces in a custom usercss template

This commit is contained in:
tophf 2018-08-06 20:56:33 +03:00
parent baf037e0c4
commit bfb35e77b8

View File

@ -128,7 +128,7 @@ function createSourceEditor(style) {
style.name || style.name ||
t('usercssReplaceTemplateName') + ' - ' + new Date().toLocaleString()}`); t('usercssReplaceTemplateName') + ' - ' + new Date().toLocaleString()}`);
// 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(/\s*@-moz-document[^{]*\{[^}]*\}\s*$|\s+$/g, '') + '\n\n' + section;
cm.startOperation(); cm.startOperation();
cm.setValue(style.sourceCode); cm.setValue(style.sourceCode);
cm.clearHistory(); cm.clearHistory();