@adeu/core 1.10.0 → 1.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +30 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +30 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/engine.ts +126 -43
package/dist/index.cjs
CHANGED
|
@@ -2720,7 +2720,10 @@ var RedlineEngine = class {
|
|
|
2720
2720
|
if (!full_text) return [null, null];
|
|
2721
2721
|
const before_start = Math.max(0, start_idx - 30);
|
|
2722
2722
|
const context_before = full_text.substring(before_start, start_idx);
|
|
2723
|
-
const context_after = full_text.substring(
|
|
2723
|
+
const context_after = full_text.substring(
|
|
2724
|
+
start_idx + length,
|
|
2725
|
+
start_idx + length + 30
|
|
2726
|
+
);
|
|
2724
2727
|
const critic_markup = `${context_before}{--${target_text}--}{++${new_text}++}${context_after}`;
|
|
2725
2728
|
let clean_text = critic_markup;
|
|
2726
2729
|
clean_text = clean_text.replace(/\{>>.*?<<\}/gs, "");
|
|
@@ -2892,7 +2895,9 @@ var RedlineEngine = class {
|
|
|
2892
2895
|
overrideEl.parentNode?.removeChild(overrideEl);
|
|
2893
2896
|
}
|
|
2894
2897
|
}
|
|
2895
|
-
pkg.parts = pkg.parts.filter(
|
|
2898
|
+
pkg.parts = pkg.parts.filter(
|
|
2899
|
+
(p) => !p.partname.toLowerCase().includes("comments")
|
|
2900
|
+
);
|
|
2896
2901
|
for (const key of Object.keys(pkg.unzipped)) {
|
|
2897
2902
|
if (key.toLowerCase().includes("comments")) {
|
|
2898
2903
|
delete pkg.unzipped[key];
|
|
@@ -3478,7 +3483,10 @@ var RedlineEngine = class {
|
|
|
3478
3483
|
const [pfx, sfx] = trim_common_context(matched, edit.new_text || "");
|
|
3479
3484
|
const t_end = matched.length - sfx;
|
|
3480
3485
|
const final_target = matched.substring(pfx, t_end);
|
|
3481
|
-
const final_new = (edit.new_text || "").substring(
|
|
3486
|
+
const final_new = (edit.new_text || "").substring(
|
|
3487
|
+
pfx,
|
|
3488
|
+
(edit.new_text || "").length - sfx
|
|
3489
|
+
);
|
|
3482
3490
|
if (final_target.includes("\n\n")) {
|
|
3483
3491
|
if (final_new.includes("\n\n")) {
|
|
3484
3492
|
const parts = matched.split("\n\n");
|
|
@@ -3634,7 +3642,9 @@ var RedlineEngine = class {
|
|
|
3634
3642
|
if (dry_run_mode) {
|
|
3635
3643
|
for (const edit of edits) {
|
|
3636
3644
|
const single_errors = this.validate_edits([edit]);
|
|
3637
|
-
const warning = this._check_punctuation_warning(
|
|
3645
|
+
const warning = this._check_punctuation_warning(
|
|
3646
|
+
edit.target_text || ""
|
|
3647
|
+
);
|
|
3638
3648
|
if (single_errors.length > 0) {
|
|
3639
3649
|
skipped_edits++;
|
|
3640
3650
|
edits_reports.push({
|
|
@@ -3688,7 +3698,9 @@ var RedlineEngine = class {
|
|
|
3688
3698
|
for (const edit of cloned_edits) {
|
|
3689
3699
|
const success = edit._applied_status || false;
|
|
3690
3700
|
const error_msg = edit._error_msg || null;
|
|
3691
|
-
const warning = this._check_punctuation_warning(
|
|
3701
|
+
const warning = this._check_punctuation_warning(
|
|
3702
|
+
edit.target_text || ""
|
|
3703
|
+
);
|
|
3692
3704
|
let critic_markup = null;
|
|
3693
3705
|
let clean_text = null;
|
|
3694
3706
|
if (success) {
|
|
@@ -3716,7 +3728,7 @@ var RedlineEngine = class {
|
|
|
3716
3728
|
skipped_details: this.skipped_details,
|
|
3717
3729
|
edits: edits_reports,
|
|
3718
3730
|
engine: "node",
|
|
3719
|
-
version: "1.
|
|
3731
|
+
version: "1.10.0"
|
|
3720
3732
|
};
|
|
3721
3733
|
}
|
|
3722
3734
|
apply_edits(edits) {
|
|
@@ -4239,7 +4251,10 @@ var RedlineEngine = class {
|
|
|
4239
4251
|
if (result.first_node.tagName === "w:p") {
|
|
4240
4252
|
first_anchor_target = findAllDescendants(result.first_node, "w:ins")[0] || result.first_node;
|
|
4241
4253
|
}
|
|
4242
|
-
const anchor = ascend_to_paragraph_child(
|
|
4254
|
+
const anchor = ascend_to_paragraph_child(
|
|
4255
|
+
first_anchor_target,
|
|
4256
|
+
host_p
|
|
4257
|
+
);
|
|
4243
4258
|
this._attach_comment(host_p, anchor, anchor, edit.comment);
|
|
4244
4259
|
}
|
|
4245
4260
|
}
|
|
@@ -4251,7 +4266,10 @@ var RedlineEngine = class {
|
|
|
4251
4266
|
length,
|
|
4252
4267
|
rebuild_map
|
|
4253
4268
|
);
|
|
4254
|
-
const virtual_spans = active_mapper.get_virtual_spans_in_range(
|
|
4269
|
+
const virtual_spans = active_mapper.get_virtual_spans_in_range(
|
|
4270
|
+
start_idx,
|
|
4271
|
+
length
|
|
4272
|
+
);
|
|
4255
4273
|
if (target_runs.length === 0 && virtual_spans.length === 0) return false;
|
|
4256
4274
|
const affected_ps = /* @__PURE__ */ new Set();
|
|
4257
4275
|
for (const run of target_runs) {
|
|
@@ -4334,7 +4352,10 @@ var RedlineEngine = class {
|
|
|
4334
4352
|
let pPr = findChild(p1_element, "w:pPr");
|
|
4335
4353
|
if (!pPr) {
|
|
4336
4354
|
pPr = p1_element.ownerDocument.createElement("w:pPr");
|
|
4337
|
-
p1_element.insertBefore(
|
|
4355
|
+
p1_element.insertBefore(
|
|
4356
|
+
pPr,
|
|
4357
|
+
p1_element.firstChild
|
|
4358
|
+
);
|
|
4338
4359
|
}
|
|
4339
4360
|
let rPr = findChild(pPr, "w:rPr");
|
|
4340
4361
|
if (!rPr) {
|