@adeu/core 1.19.1 → 1.20.0
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 +19 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +19 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/engine.ts +14 -5
- package/src/mapper.ts +21 -1
- package/src/repro.insertion-anchor.test.ts +91 -0
package/dist/index.cjs
CHANGED
|
@@ -1941,7 +1941,16 @@ ${header}`;
|
|
|
1941
1941
|
if (preceding[i].run) return [preceding[i].run, preceding[i].paragraph];
|
|
1942
1942
|
}
|
|
1943
1943
|
for (let i = preceding.length - 1; i >= 0; i--) {
|
|
1944
|
-
|
|
1944
|
+
const para = preceding[i].paragraph;
|
|
1945
|
+
if (para) {
|
|
1946
|
+
for (let j = this.spans.length - 1; j >= 0; j--) {
|
|
1947
|
+
const prev = this.spans[j];
|
|
1948
|
+
if (prev.end <= index && prev.run !== null && prev.paragraph === para) {
|
|
1949
|
+
return [prev.run, prev.paragraph];
|
|
1950
|
+
}
|
|
1951
|
+
}
|
|
1952
|
+
return [null, para];
|
|
1953
|
+
}
|
|
1945
1954
|
}
|
|
1946
1955
|
}
|
|
1947
1956
|
const containing = this.spans.filter(
|
|
@@ -5359,19 +5368,24 @@ var RedlineEngine = class {
|
|
|
5359
5368
|
const is_inline_first = result.first_node.tagName === "w:ins";
|
|
5360
5369
|
if (is_inline_first) {
|
|
5361
5370
|
if (anchor_run) {
|
|
5362
|
-
|
|
5371
|
+
let anchor_el = anchor_run._element;
|
|
5372
|
+
let anchor_parent = anchor_el.parentNode;
|
|
5373
|
+
if (anchor_parent && anchor_parent.tagName === "w:del") {
|
|
5374
|
+
anchor_el = anchor_parent;
|
|
5375
|
+
anchor_parent = anchor_el.parentNode;
|
|
5376
|
+
}
|
|
5363
5377
|
const before_anchor = start_idx === 0;
|
|
5364
5378
|
if (anchor_parent && anchor_parent.tagName === "w:ins") {
|
|
5365
5379
|
this._insert_and_split_ins(
|
|
5366
5380
|
anchor_parent,
|
|
5367
|
-
|
|
5381
|
+
anchor_el,
|
|
5368
5382
|
result.first_node,
|
|
5369
5383
|
before_anchor
|
|
5370
5384
|
);
|
|
5371
5385
|
} else if (before_anchor && anchor_parent) {
|
|
5372
|
-
anchor_parent.insertBefore(result.first_node,
|
|
5386
|
+
anchor_parent.insertBefore(result.first_node, anchor_el);
|
|
5373
5387
|
} else {
|
|
5374
|
-
insertAfter(result.first_node,
|
|
5388
|
+
insertAfter(result.first_node, anchor_el);
|
|
5375
5389
|
}
|
|
5376
5390
|
} else if (anchor_para) {
|
|
5377
5391
|
const para_el = anchor_para._element;
|