moz-import: trim empty lines at section start/end

This commit is contained in:
tophf 2017-04-03 02:19:43 +03:00
parent 0ceff44000
commit 2875bb77d0

13
edit.js
View File

@ -1497,15 +1497,20 @@ function fromMozillaFormat() {
} }
} }
function doAddSection(section) { function doAddSection(section) {
section.code = section.code.trim();
// don't add empty sections
if (!section.code
&& !section.urls
&& !section.urlPrefixes
&& !section.domains
&& !section.regexps) {
return;
}
if (!firstAddedCM) { if (!firstAddedCM) {
if (!initFirstSection(section)) { if (!initFirstSection(section)) {
return; return;
} }
} }
// don't add empty sections
if (!(section.code || section.urls || section.urlPrefixes || section.domains || section.regexps)) {
return;
}
setCleanItem(addSection(null, section), false); setCleanItem(addSection(null, section), false);
firstAddedCM = firstAddedCM || editors.last; firstAddedCM = firstAddedCM || editors.last;
} }