@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.js CHANGED
@@ -1890,7 +1890,16 @@ ${header}`;
1890
1890
  if (preceding[i].run) return [preceding[i].run, preceding[i].paragraph];
1891
1891
  }
1892
1892
  for (let i = preceding.length - 1; i >= 0; i--) {
1893
- if (preceding[i].paragraph) return [null, preceding[i].paragraph];
1893
+ const para = preceding[i].paragraph;
1894
+ if (para) {
1895
+ for (let j = this.spans.length - 1; j >= 0; j--) {
1896
+ const prev = this.spans[j];
1897
+ if (prev.end <= index && prev.run !== null && prev.paragraph === para) {
1898
+ return [prev.run, prev.paragraph];
1899
+ }
1900
+ }
1901
+ return [null, para];
1902
+ }
1894
1903
  }
1895
1904
  }
1896
1905
  const containing = this.spans.filter(
@@ -5308,19 +5317,24 @@ var RedlineEngine = class {
5308
5317
  const is_inline_first = result.first_node.tagName === "w:ins";
5309
5318
  if (is_inline_first) {
5310
5319
  if (anchor_run) {
5311
- const anchor_parent = anchor_run._element.parentNode;
5320
+ let anchor_el = anchor_run._element;
5321
+ let anchor_parent = anchor_el.parentNode;
5322
+ if (anchor_parent && anchor_parent.tagName === "w:del") {
5323
+ anchor_el = anchor_parent;
5324
+ anchor_parent = anchor_el.parentNode;
5325
+ }
5312
5326
  const before_anchor = start_idx === 0;
5313
5327
  if (anchor_parent && anchor_parent.tagName === "w:ins") {
5314
5328
  this._insert_and_split_ins(
5315
5329
  anchor_parent,
5316
- anchor_run._element,
5330
+ anchor_el,
5317
5331
  result.first_node,
5318
5332
  before_anchor
5319
5333
  );
5320
5334
  } else if (before_anchor && anchor_parent) {
5321
- anchor_parent.insertBefore(result.first_node, anchor_run._element);
5335
+ anchor_parent.insertBefore(result.first_node, anchor_el);
5322
5336
  } else {
5323
- insertAfter(result.first_node, anchor_run._element);
5337
+ insertAfter(result.first_node, anchor_el);
5324
5338
  }
5325
5339
  } else if (anchor_para) {
5326
5340
  const para_el = anchor_para._element;