@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.js
CHANGED
|
@@ -2670,7 +2670,10 @@ var RedlineEngine = class {
|
|
|
2670
2670
|
if (!full_text) return [null, null];
|
|
2671
2671
|
const before_start = Math.max(0, start_idx - 30);
|
|
2672
2672
|
const context_before = full_text.substring(before_start, start_idx);
|
|
2673
|
-
const context_after = full_text.substring(
|
|
2673
|
+
const context_after = full_text.substring(
|
|
2674
|
+
start_idx + length,
|
|
2675
|
+
start_idx + length + 30
|
|
2676
|
+
);
|
|
2674
2677
|
const critic_markup = `${context_before}{--${target_text}--}{++${new_text}++}${context_after}`;
|
|
2675
2678
|
let clean_text = critic_markup;
|
|
2676
2679
|
clean_text = clean_text.replace(/\{>>.*?<<\}/gs, "");
|
|
@@ -2842,7 +2845,9 @@ var RedlineEngine = class {
|
|
|
2842
2845
|
overrideEl.parentNode?.removeChild(overrideEl);
|
|
2843
2846
|
}
|
|
2844
2847
|
}
|
|
2845
|
-
pkg.parts = pkg.parts.filter(
|
|
2848
|
+
pkg.parts = pkg.parts.filter(
|
|
2849
|
+
(p) => !p.partname.toLowerCase().includes("comments")
|
|
2850
|
+
);
|
|
2846
2851
|
for (const key of Object.keys(pkg.unzipped)) {
|
|
2847
2852
|
if (key.toLowerCase().includes("comments")) {
|
|
2848
2853
|
delete pkg.unzipped[key];
|
|
@@ -3428,7 +3433,10 @@ var RedlineEngine = class {
|
|
|
3428
3433
|
const [pfx, sfx] = trim_common_context(matched, edit.new_text || "");
|
|
3429
3434
|
const t_end = matched.length - sfx;
|
|
3430
3435
|
const final_target = matched.substring(pfx, t_end);
|
|
3431
|
-
const final_new = (edit.new_text || "").substring(
|
|
3436
|
+
const final_new = (edit.new_text || "").substring(
|
|
3437
|
+
pfx,
|
|
3438
|
+
(edit.new_text || "").length - sfx
|
|
3439
|
+
);
|
|
3432
3440
|
if (final_target.includes("\n\n")) {
|
|
3433
3441
|
if (final_new.includes("\n\n")) {
|
|
3434
3442
|
const parts = matched.split("\n\n");
|
|
@@ -3584,7 +3592,9 @@ var RedlineEngine = class {
|
|
|
3584
3592
|
if (dry_run_mode) {
|
|
3585
3593
|
for (const edit of edits) {
|
|
3586
3594
|
const single_errors = this.validate_edits([edit]);
|
|
3587
|
-
const warning = this._check_punctuation_warning(
|
|
3595
|
+
const warning = this._check_punctuation_warning(
|
|
3596
|
+
edit.target_text || ""
|
|
3597
|
+
);
|
|
3588
3598
|
if (single_errors.length > 0) {
|
|
3589
3599
|
skipped_edits++;
|
|
3590
3600
|
edits_reports.push({
|
|
@@ -3638,7 +3648,9 @@ var RedlineEngine = class {
|
|
|
3638
3648
|
for (const edit of cloned_edits) {
|
|
3639
3649
|
const success = edit._applied_status || false;
|
|
3640
3650
|
const error_msg = edit._error_msg || null;
|
|
3641
|
-
const warning = this._check_punctuation_warning(
|
|
3651
|
+
const warning = this._check_punctuation_warning(
|
|
3652
|
+
edit.target_text || ""
|
|
3653
|
+
);
|
|
3642
3654
|
let critic_markup = null;
|
|
3643
3655
|
let clean_text = null;
|
|
3644
3656
|
if (success) {
|
|
@@ -3666,7 +3678,7 @@ var RedlineEngine = class {
|
|
|
3666
3678
|
skipped_details: this.skipped_details,
|
|
3667
3679
|
edits: edits_reports,
|
|
3668
3680
|
engine: "node",
|
|
3669
|
-
version: "1.
|
|
3681
|
+
version: "1.10.0"
|
|
3670
3682
|
};
|
|
3671
3683
|
}
|
|
3672
3684
|
apply_edits(edits) {
|
|
@@ -4189,7 +4201,10 @@ var RedlineEngine = class {
|
|
|
4189
4201
|
if (result.first_node.tagName === "w:p") {
|
|
4190
4202
|
first_anchor_target = findAllDescendants(result.first_node, "w:ins")[0] || result.first_node;
|
|
4191
4203
|
}
|
|
4192
|
-
const anchor = ascend_to_paragraph_child(
|
|
4204
|
+
const anchor = ascend_to_paragraph_child(
|
|
4205
|
+
first_anchor_target,
|
|
4206
|
+
host_p
|
|
4207
|
+
);
|
|
4193
4208
|
this._attach_comment(host_p, anchor, anchor, edit.comment);
|
|
4194
4209
|
}
|
|
4195
4210
|
}
|
|
@@ -4201,7 +4216,10 @@ var RedlineEngine = class {
|
|
|
4201
4216
|
length,
|
|
4202
4217
|
rebuild_map
|
|
4203
4218
|
);
|
|
4204
|
-
const virtual_spans = active_mapper.get_virtual_spans_in_range(
|
|
4219
|
+
const virtual_spans = active_mapper.get_virtual_spans_in_range(
|
|
4220
|
+
start_idx,
|
|
4221
|
+
length
|
|
4222
|
+
);
|
|
4205
4223
|
if (target_runs.length === 0 && virtual_spans.length === 0) return false;
|
|
4206
4224
|
const affected_ps = /* @__PURE__ */ new Set();
|
|
4207
4225
|
for (const run of target_runs) {
|
|
@@ -4284,7 +4302,10 @@ var RedlineEngine = class {
|
|
|
4284
4302
|
let pPr = findChild(p1_element, "w:pPr");
|
|
4285
4303
|
if (!pPr) {
|
|
4286
4304
|
pPr = p1_element.ownerDocument.createElement("w:pPr");
|
|
4287
|
-
p1_element.insertBefore(
|
|
4305
|
+
p1_element.insertBefore(
|
|
4306
|
+
pPr,
|
|
4307
|
+
p1_element.firstChild
|
|
4308
|
+
);
|
|
4288
4309
|
}
|
|
4289
4310
|
let rPr = findChild(pPr, "w:rPr");
|
|
4290
4311
|
if (!rPr) {
|