preserve dirty after importing moz-format [v2], fixes #1163

This commit is contained in:
tophf 2021-02-02 00:33:41 +03:00
parent 3a3104b30a
commit c41a5f92c3

View File

@ -371,6 +371,7 @@ function SectionsEditor() {
await initSections(sections, {
replace: replaceOldStyle,
focusOn: replaceOldStyle ? 0 : false,
keepDirty: true,
});
helpPopup.close();
}
@ -473,6 +474,7 @@ function SectionsEditor() {
async function initSections(src, {
focusOn = 0,
replace = false,
keepDirty = false, // used by import
} = {}) {
if (replace) {
sections.forEach(s => s.remove(true));
@ -505,7 +507,7 @@ function SectionsEditor() {
if (si) forceRefresh = y < si.scrollY2 && (y += si.cms[i].parentHeight) > si.scrollY;
insertSectionAfter(src[i], null, forceRefresh, si && si.cms[i]);
setGlobalProgress(i, src.length);
dirty.clear();
if (!keepDirty) dirty.clear();
if (i === focusOn) sections[i].cm.focus();
}
if (!si) requestAnimationFrame(fitToAvailableSpace);