From c41a5f92c34c92e68ad1aedc1b560603a34cf5dc Mon Sep 17 00:00:00 2001 From: tophf Date: Tue, 2 Feb 2021 00:33:41 +0300 Subject: [PATCH] preserve `dirty` after importing moz-format [v2], fixes #1163 --- edit/sections-editor.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/edit/sections-editor.js b/edit/sections-editor.js index af539415..2b4a7442 100644 --- a/edit/sections-editor.js +++ b/edit/sections-editor.js @@ -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);