make editor fully clean on saving

This commit is contained in:
tophf 2017-12-17 21:54:36 +03:00
parent 9e11435923
commit 001db9a19f

View File

@ -319,6 +319,7 @@ function isCleanGlobal() {
} }
function setCleanGlobal() { function setCleanGlobal() {
setCleanItem($('#sections'), true);
$$('#header, #sections > div').forEach(setCleanSection); $$('#header, #sections > div').forEach(setCleanSection);
// forget the dirty applies-to ids from a deleted section after the style was saved // forget the dirty applies-to ids from a deleted section after the style was saved
dirty = {}; dirty = {};
@ -326,14 +327,9 @@ function setCleanGlobal() {
function setCleanSection(section) { function setCleanSection(section) {
$$('.style-contributor', section).forEach(node => setCleanItem(node, true)); $$('.style-contributor', section).forEach(node => setCleanItem(node, true));
setCleanItem(section, true);
// #header section has no codemirror
const cm = section.CodeMirror;
if (cm) {
section.savedValue = cm.changeGeneration();
updateTitle(); updateTitle();
} }
}
function toggleStyle() { function toggleStyle() {
$('#enabled').checked = !$('#enabled').checked; $('#enabled').checked = !$('#enabled').checked;