fix(est): combine quantity text edits

This commit is contained in:
2026-11-07 02:35:12 +09:00
parent 170086a5b1
commit c03929e369
2 changed files with 14 additions and 1 deletions
@@ -101,6 +101,17 @@ def test_quantity_document_edit_across_character_styles_preserves_tags():
assert result == {"same": True, "tags": True}
def test_quantity_document_edit_across_styles_and_separate_marker():
script = r"""const q=require('./tools/est-test/native-quantity.cjs'),w=require('./tools/est-test/export-quantity.cjs');
const doc='<cs nr=1/><cs nr=2/><div><c nr=1/>abc<c nr=2/>def<begin Tag=2 wpsty=[[Name:&#34;r000001&#34;;]]/>6<end Tag=2/></div>';
const old=q.fromWpt('A','문서',doc,[],{}),edited=structuredClone(old);
edited.rows[0].LineData=edited.rows[0].LineData.replace('bcde','변경').replace('6','12');
const next=w.editDocument(doc,old,edited),again=q.fromWpt('A','문서',next,[],{}),tags=x=>x.match(/<[^>]*>/g);
process.stdout.write(JSON.stringify({same:JSON.stringify(again)===JSON.stringify(edited),tags:JSON.stringify(tags(doc))===JSON.stringify(tags(next))}));"""
result = json.loads(subprocess.check_output(["node", "-e", script], cwd=ROOT).decode("utf-8"))
assert result == {"same": True, "tags": True}
def test_multiple_quantity_text_segments_preserve_original_tags_when_sample_exists():
sample = Path("C:/Dasansoft/Est Plus 2/Data/ProjectData/main.estx")
if not sample.exists():
+3 -1
View File
@@ -121,7 +121,9 @@ function editDocument(text, oldSheet, sheet) {
if (previous[i] === next[i]) continue;
previous[i] = next[i];
const updated = { ...current, LineData: previous.join("") };
const patched = editRun(candidate, current, updated, parse);
const patched =
editRun(candidate, current, updated, parse) ||
editStyledRuns(candidate, current, updated, parse);
if (!patched) break;
candidate = patched;
current = updated;