ooxml-core 1.24.1 → 1.24.2

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.
@@ -3772,7 +3772,24 @@ function controlIds(doc) {
3772
3772
  }
3773
3773
  var unusedControlId = (doc) => freshControlId(controlIds(doc));
3774
3774
  var holdsRowsOrCells = (node4) => node4?.nodeType === 1 && ["tr", "tc", "sdt", "customXml"].some((name3) => named2(node4, name3));
3775
+ function markersIntoContent(sdt) {
3776
+ const content2 = sdtContent(sdt);
3777
+ if (!content2) return;
3778
+ const anchor2 = content2.firstChild;
3779
+ let after = false;
3780
+ for (const child7 of Array.from(sdt.childNodes)) {
3781
+ if (child7 === content2) {
3782
+ after = true;
3783
+ continue;
3784
+ }
3785
+ const element3 = child7;
3786
+ if (child7.nodeType !== 1 || named2(element3, "sdtPr") || named2(element3, "sdtEndPr")) continue;
3787
+ if (after) content2.appendChild(child7);
3788
+ else content2.insertBefore(child7, anchor2);
3789
+ }
3790
+ }
3775
3791
  function takeOut(doc, element3, sdt) {
3792
+ markersIntoContent(sdt);
3776
3793
  const content2 = element3.parentNode;
3777
3794
  const parent = sdt.parentNode;
3778
3795
  const siblings = (from, step2) => {
@@ -3827,7 +3844,9 @@ function placeTableControl(doc, element3, next, base3) {
3827
3844
  }
3828
3845
  const shared = isSdt(before) && sdtContent(before);
3829
3846
  const { id: id4 } = next;
3830
- if (shared && typeof id4 === "string" && (createdFor.get(before) ?? idOf(before)) === id4) {
3847
+ const joins = shared && typeof id4 === "string" && (createdFor.get(before) ?? idOf(before)) === id4;
3848
+ if (joins) {
3849
+ markersIntoContent(before);
3831
3850
  for (const node4 of [...between, element3]) shared.appendChild(node4);
3832
3851
  return;
3833
3852
  }
@@ -3844,6 +3863,10 @@ function unwrapDroppedControls(elements2, next) {
3844
3863
  if (sdt) kept.set(sdt, Boolean(kept.get(sdt)) || next[index4] !== void 0);
3845
3864
  });
3846
3865
  for (const [sdt, keep2] of kept) if (!keep2) unwrapContentControl(sdt);
3866
+ elements2.forEach((element3, index4) => {
3867
+ const sdt = next[index4] === void 0 ? enclosingSdt(element3) : void 0;
3868
+ if (sdt) takeOut(element3.ownerDocument, element3, sdt);
3869
+ });
3847
3870
  }
3848
3871
 
3849
3872
  // docx/write-table.ts
@@ -3766,7 +3766,24 @@ function controlIds(doc) {
3766
3766
  }
3767
3767
  var unusedControlId = (doc) => freshControlId(controlIds(doc));
3768
3768
  var holdsRowsOrCells = (node4) => node4?.nodeType === 1 && ["tr", "tc", "sdt", "customXml"].some((name3) => named2(node4, name3));
3769
+ function markersIntoContent(sdt) {
3770
+ const content2 = sdtContent(sdt);
3771
+ if (!content2) return;
3772
+ const anchor2 = content2.firstChild;
3773
+ let after = false;
3774
+ for (const child7 of Array.from(sdt.childNodes)) {
3775
+ if (child7 === content2) {
3776
+ after = true;
3777
+ continue;
3778
+ }
3779
+ const element3 = child7;
3780
+ if (child7.nodeType !== 1 || named2(element3, "sdtPr") || named2(element3, "sdtEndPr")) continue;
3781
+ if (after) content2.appendChild(child7);
3782
+ else content2.insertBefore(child7, anchor2);
3783
+ }
3784
+ }
3769
3785
  function takeOut(doc, element3, sdt) {
3786
+ markersIntoContent(sdt);
3770
3787
  const content2 = element3.parentNode;
3771
3788
  const parent = sdt.parentNode;
3772
3789
  const siblings = (from, step2) => {
@@ -3821,7 +3838,9 @@ function placeTableControl(doc, element3, next, base3) {
3821
3838
  }
3822
3839
  const shared = isSdt(before) && sdtContent(before);
3823
3840
  const { id: id4 } = next;
3824
- if (shared && typeof id4 === "string" && (createdFor.get(before) ?? idOf(before)) === id4) {
3841
+ const joins = shared && typeof id4 === "string" && (createdFor.get(before) ?? idOf(before)) === id4;
3842
+ if (joins) {
3843
+ markersIntoContent(before);
3825
3844
  for (const node4 of [...between, element3]) shared.appendChild(node4);
3826
3845
  return;
3827
3846
  }
@@ -3838,6 +3857,10 @@ function unwrapDroppedControls(elements2, next) {
3838
3857
  if (sdt) kept.set(sdt, Boolean(kept.get(sdt)) || next[index4] !== void 0);
3839
3858
  });
3840
3859
  for (const [sdt, keep2] of kept) if (!keep2) unwrapContentControl(sdt);
3860
+ elements2.forEach((element3, index4) => {
3861
+ const sdt = next[index4] === void 0 ? enclosingSdt(element3) : void 0;
3862
+ if (sdt) takeOut(element3.ownerDocument, element3, sdt);
3863
+ });
3841
3864
  }
3842
3865
 
3843
3866
  // docx/write-table.ts
@@ -3150,7 +3150,24 @@ function controlIds(doc) {
3150
3150
  }
3151
3151
  var unusedControlId = (doc) => freshControlId(controlIds(doc));
3152
3152
  var holdsRowsOrCells = (node) => node?.nodeType === 1 && ["tr", "tc", "sdt", "customXml"].some((name) => named2(node, name));
3153
+ function markersIntoContent(sdt) {
3154
+ const content = sdtContent(sdt);
3155
+ if (!content) return;
3156
+ const anchor = content.firstChild;
3157
+ let after = false;
3158
+ for (const child4 of Array.from(sdt.childNodes)) {
3159
+ if (child4 === content) {
3160
+ after = true;
3161
+ continue;
3162
+ }
3163
+ const element2 = child4;
3164
+ if (child4.nodeType !== 1 || named2(element2, "sdtPr") || named2(element2, "sdtEndPr")) continue;
3165
+ if (after) content.appendChild(child4);
3166
+ else content.insertBefore(child4, anchor);
3167
+ }
3168
+ }
3153
3169
  function takeOut(doc, element2, sdt) {
3170
+ markersIntoContent(sdt);
3154
3171
  const content = element2.parentNode;
3155
3172
  const parent = sdt.parentNode;
3156
3173
  const siblings = (from, step) => {
@@ -3205,7 +3222,9 @@ function placeTableControl(doc, element2, next, base) {
3205
3222
  }
3206
3223
  const shared = isSdt(before) && sdtContent(before);
3207
3224
  const { id } = next;
3208
- if (shared && typeof id === "string" && (createdFor.get(before) ?? idOf(before)) === id) {
3225
+ const joins = shared && typeof id === "string" && (createdFor.get(before) ?? idOf(before)) === id;
3226
+ if (joins) {
3227
+ markersIntoContent(before);
3209
3228
  for (const node of [...between, element2]) shared.appendChild(node);
3210
3229
  return;
3211
3230
  }
@@ -3222,6 +3241,10 @@ function unwrapDroppedControls(elements2, next) {
3222
3241
  if (sdt) kept.set(sdt, Boolean(kept.get(sdt)) || next[index] !== void 0);
3223
3242
  });
3224
3243
  for (const [sdt, keep] of kept) if (!keep) unwrapContentControl(sdt);
3244
+ elements2.forEach((element2, index) => {
3245
+ const sdt = next[index] === void 0 ? enclosingSdt(element2) : void 0;
3246
+ if (sdt) takeOut(element2.ownerDocument, element2, sdt);
3247
+ });
3225
3248
  }
3226
3249
 
3227
3250
  // docx/write-table.ts
@@ -3144,7 +3144,24 @@ function controlIds(doc) {
3144
3144
  }
3145
3145
  var unusedControlId = (doc) => freshControlId(controlIds(doc));
3146
3146
  var holdsRowsOrCells = (node) => node?.nodeType === 1 && ["tr", "tc", "sdt", "customXml"].some((name) => named2(node, name));
3147
+ function markersIntoContent(sdt) {
3148
+ const content = sdtContent(sdt);
3149
+ if (!content) return;
3150
+ const anchor = content.firstChild;
3151
+ let after = false;
3152
+ for (const child4 of Array.from(sdt.childNodes)) {
3153
+ if (child4 === content) {
3154
+ after = true;
3155
+ continue;
3156
+ }
3157
+ const element2 = child4;
3158
+ if (child4.nodeType !== 1 || named2(element2, "sdtPr") || named2(element2, "sdtEndPr")) continue;
3159
+ if (after) content.appendChild(child4);
3160
+ else content.insertBefore(child4, anchor);
3161
+ }
3162
+ }
3147
3163
  function takeOut(doc, element2, sdt) {
3164
+ markersIntoContent(sdt);
3148
3165
  const content = element2.parentNode;
3149
3166
  const parent = sdt.parentNode;
3150
3167
  const siblings = (from, step) => {
@@ -3199,7 +3216,9 @@ function placeTableControl(doc, element2, next, base) {
3199
3216
  }
3200
3217
  const shared = isSdt(before) && sdtContent(before);
3201
3218
  const { id } = next;
3202
- if (shared && typeof id === "string" && (createdFor.get(before) ?? idOf(before)) === id) {
3219
+ const joins = shared && typeof id === "string" && (createdFor.get(before) ?? idOf(before)) === id;
3220
+ if (joins) {
3221
+ markersIntoContent(before);
3203
3222
  for (const node of [...between, element2]) shared.appendChild(node);
3204
3223
  return;
3205
3224
  }
@@ -3216,6 +3235,10 @@ function unwrapDroppedControls(elements2, next) {
3216
3235
  if (sdt) kept.set(sdt, Boolean(kept.get(sdt)) || next[index] !== void 0);
3217
3236
  });
3218
3237
  for (const [sdt, keep] of kept) if (!keep) unwrapContentControl(sdt);
3238
+ elements2.forEach((element2, index) => {
3239
+ const sdt = next[index] === void 0 ? enclosingSdt(element2) : void 0;
3240
+ if (sdt) takeOut(element2.ownerDocument, element2, sdt);
3241
+ });
3219
3242
  }
3220
3243
 
3221
3244
  // docx/write-table.ts
@@ -4264,7 +4264,24 @@ function controlIds(doc) {
4264
4264
  }
4265
4265
  var unusedControlId = (doc) => freshControlId(controlIds(doc));
4266
4266
  var holdsRowsOrCells = (node) => node?.nodeType === 1 && ["tr", "tc", "sdt", "customXml"].some((name) => named2(node, name));
4267
+ function markersIntoContent(sdt) {
4268
+ const content = sdtContent(sdt);
4269
+ if (!content) return;
4270
+ const anchor = content.firstChild;
4271
+ let after = false;
4272
+ for (const child4 of Array.from(sdt.childNodes)) {
4273
+ if (child4 === content) {
4274
+ after = true;
4275
+ continue;
4276
+ }
4277
+ const element2 = child4;
4278
+ if (child4.nodeType !== 1 || named2(element2, "sdtPr") || named2(element2, "sdtEndPr")) continue;
4279
+ if (after) content.appendChild(child4);
4280
+ else content.insertBefore(child4, anchor);
4281
+ }
4282
+ }
4267
4283
  function takeOut(doc, element2, sdt) {
4284
+ markersIntoContent(sdt);
4268
4285
  const content = element2.parentNode;
4269
4286
  const parent = sdt.parentNode;
4270
4287
  const siblings = (from, step) => {
@@ -4319,7 +4336,9 @@ function placeTableControl(doc, element2, next, base) {
4319
4336
  }
4320
4337
  const shared = isSdt(before) && sdtContent(before);
4321
4338
  const { id } = next;
4322
- if (shared && typeof id === "string" && (createdFor.get(before) ?? idOf(before)) === id) {
4339
+ const joins = shared && typeof id === "string" && (createdFor.get(before) ?? idOf(before)) === id;
4340
+ if (joins) {
4341
+ markersIntoContent(before);
4323
4342
  for (const node of [...between, element2]) shared.appendChild(node);
4324
4343
  return;
4325
4344
  }
@@ -4336,6 +4355,10 @@ function unwrapDroppedControls(elements2, next) {
4336
4355
  if (sdt) kept.set(sdt, Boolean(kept.get(sdt)) || next[index] !== void 0);
4337
4356
  });
4338
4357
  for (const [sdt, keep] of kept) if (!keep) unwrapContentControl(sdt);
4358
+ elements2.forEach((element2, index) => {
4359
+ const sdt = next[index] === void 0 ? enclosingSdt(element2) : void 0;
4360
+ if (sdt) takeOut(element2.ownerDocument, element2, sdt);
4361
+ });
4339
4362
  }
4340
4363
 
4341
4364
  // docx/write-table.ts
@@ -4258,7 +4258,24 @@ function controlIds(doc) {
4258
4258
  }
4259
4259
  var unusedControlId = (doc) => freshControlId(controlIds(doc));
4260
4260
  var holdsRowsOrCells = (node) => node?.nodeType === 1 && ["tr", "tc", "sdt", "customXml"].some((name) => named2(node, name));
4261
+ function markersIntoContent(sdt) {
4262
+ const content = sdtContent(sdt);
4263
+ if (!content) return;
4264
+ const anchor = content.firstChild;
4265
+ let after = false;
4266
+ for (const child4 of Array.from(sdt.childNodes)) {
4267
+ if (child4 === content) {
4268
+ after = true;
4269
+ continue;
4270
+ }
4271
+ const element2 = child4;
4272
+ if (child4.nodeType !== 1 || named2(element2, "sdtPr") || named2(element2, "sdtEndPr")) continue;
4273
+ if (after) content.appendChild(child4);
4274
+ else content.insertBefore(child4, anchor);
4275
+ }
4276
+ }
4261
4277
  function takeOut(doc, element2, sdt) {
4278
+ markersIntoContent(sdt);
4262
4279
  const content = element2.parentNode;
4263
4280
  const parent = sdt.parentNode;
4264
4281
  const siblings = (from, step) => {
@@ -4313,7 +4330,9 @@ function placeTableControl(doc, element2, next, base) {
4313
4330
  }
4314
4331
  const shared = isSdt(before) && sdtContent(before);
4315
4332
  const { id } = next;
4316
- if (shared && typeof id === "string" && (createdFor.get(before) ?? idOf(before)) === id) {
4333
+ const joins = shared && typeof id === "string" && (createdFor.get(before) ?? idOf(before)) === id;
4334
+ if (joins) {
4335
+ markersIntoContent(before);
4317
4336
  for (const node of [...between, element2]) shared.appendChild(node);
4318
4337
  return;
4319
4338
  }
@@ -4330,6 +4349,10 @@ function unwrapDroppedControls(elements2, next) {
4330
4349
  if (sdt) kept.set(sdt, Boolean(kept.get(sdt)) || next[index] !== void 0);
4331
4350
  });
4332
4351
  for (const [sdt, keep] of kept) if (!keep) unwrapContentControl(sdt);
4352
+ elements2.forEach((element2, index) => {
4353
+ const sdt = next[index] === void 0 ? enclosingSdt(element2) : void 0;
4354
+ if (sdt) takeOut(element2.ownerDocument, element2, sdt);
4355
+ });
4333
4356
  }
4334
4357
 
4335
4358
  // docx/write-table.ts
@@ -5613,7 +5613,24 @@ function controlIds(doc) {
5613
5613
  }
5614
5614
  var unusedControlId = (doc) => freshControlId(controlIds(doc));
5615
5615
  var holdsRowsOrCells = (node) => node?.nodeType === 1 && ["tr", "tc", "sdt", "customXml"].some((name) => named2(node, name));
5616
+ function markersIntoContent(sdt) {
5617
+ const content = sdtContent(sdt);
5618
+ if (!content) return;
5619
+ const anchor = content.firstChild;
5620
+ let after = false;
5621
+ for (const child5 of Array.from(sdt.childNodes)) {
5622
+ if (child5 === content) {
5623
+ after = true;
5624
+ continue;
5625
+ }
5626
+ const element2 = child5;
5627
+ if (child5.nodeType !== 1 || named2(element2, "sdtPr") || named2(element2, "sdtEndPr")) continue;
5628
+ if (after) content.appendChild(child5);
5629
+ else content.insertBefore(child5, anchor);
5630
+ }
5631
+ }
5616
5632
  function takeOut(doc, element2, sdt) {
5633
+ markersIntoContent(sdt);
5617
5634
  const content = element2.parentNode;
5618
5635
  const parent = sdt.parentNode;
5619
5636
  const siblings = (from, step) => {
@@ -5668,7 +5685,9 @@ function placeTableControl(doc, element2, next, base) {
5668
5685
  }
5669
5686
  const shared = isSdt(before) && sdtContent(before);
5670
5687
  const { id } = next;
5671
- if (shared && typeof id === "string" && (createdFor.get(before) ?? idOf(before)) === id) {
5688
+ const joins = shared && typeof id === "string" && (createdFor.get(before) ?? idOf(before)) === id;
5689
+ if (joins) {
5690
+ markersIntoContent(before);
5672
5691
  for (const node of [...between, element2]) shared.appendChild(node);
5673
5692
  return;
5674
5693
  }
@@ -5685,6 +5704,10 @@ function unwrapDroppedControls(elements2, next) {
5685
5704
  if (sdt) kept.set(sdt, Boolean(kept.get(sdt)) || next[index] !== void 0);
5686
5705
  });
5687
5706
  for (const [sdt, keep] of kept) if (!keep) unwrapContentControl(sdt);
5707
+ elements2.forEach((element2, index) => {
5708
+ const sdt = next[index] === void 0 ? enclosingSdt(element2) : void 0;
5709
+ if (sdt) takeOut(element2.ownerDocument, element2, sdt);
5710
+ });
5688
5711
  }
5689
5712
 
5690
5713
  // docx/write-table.ts
@@ -5607,7 +5607,24 @@ function controlIds(doc) {
5607
5607
  }
5608
5608
  var unusedControlId = (doc) => freshControlId(controlIds(doc));
5609
5609
  var holdsRowsOrCells = (node) => node?.nodeType === 1 && ["tr", "tc", "sdt", "customXml"].some((name) => named2(node, name));
5610
+ function markersIntoContent(sdt) {
5611
+ const content = sdtContent(sdt);
5612
+ if (!content) return;
5613
+ const anchor = content.firstChild;
5614
+ let after = false;
5615
+ for (const child5 of Array.from(sdt.childNodes)) {
5616
+ if (child5 === content) {
5617
+ after = true;
5618
+ continue;
5619
+ }
5620
+ const element2 = child5;
5621
+ if (child5.nodeType !== 1 || named2(element2, "sdtPr") || named2(element2, "sdtEndPr")) continue;
5622
+ if (after) content.appendChild(child5);
5623
+ else content.insertBefore(child5, anchor);
5624
+ }
5625
+ }
5610
5626
  function takeOut(doc, element2, sdt) {
5627
+ markersIntoContent(sdt);
5611
5628
  const content = element2.parentNode;
5612
5629
  const parent = sdt.parentNode;
5613
5630
  const siblings = (from, step) => {
@@ -5662,7 +5679,9 @@ function placeTableControl(doc, element2, next, base) {
5662
5679
  }
5663
5680
  const shared = isSdt(before) && sdtContent(before);
5664
5681
  const { id } = next;
5665
- if (shared && typeof id === "string" && (createdFor.get(before) ?? idOf(before)) === id) {
5682
+ const joins = shared && typeof id === "string" && (createdFor.get(before) ?? idOf(before)) === id;
5683
+ if (joins) {
5684
+ markersIntoContent(before);
5666
5685
  for (const node of [...between, element2]) shared.appendChild(node);
5667
5686
  return;
5668
5687
  }
@@ -5679,6 +5698,10 @@ function unwrapDroppedControls(elements2, next) {
5679
5698
  if (sdt) kept.set(sdt, Boolean(kept.get(sdt)) || next[index] !== void 0);
5680
5699
  });
5681
5700
  for (const [sdt, keep] of kept) if (!keep) unwrapContentControl(sdt);
5701
+ elements2.forEach((element2, index) => {
5702
+ const sdt = next[index] === void 0 ? enclosingSdt(element2) : void 0;
5703
+ if (sdt) takeOut(element2.ownerDocument, element2, sdt);
5704
+ });
5682
5705
  }
5683
5706
 
5684
5707
  // docx/write-table.ts
@@ -7,7 +7,7 @@ import { type ControlSpan } from './content-control-spans.js';
7
7
  export declare const CONTROL_EDIT_META = "dve-content-control";
8
8
  /**
9
9
  * Replaces a control's content (and its state) as one edit. An inline control's text is replaced;
10
- * a cell control's cell keeps one paragraph, its first, holding the new text.
10
+ * a cell control's cell holds the new text in its first paragraph (`cellContent`).
11
11
  */
12
12
  export declare function replaceControlContent(state: EditorState, span: ControlSpan, edit: ControlChange): Transaction;
13
13
  /** Stores new properties on every run or paragraph of the control. */
@@ -1 +1 @@
1
- {"version":3,"file":"content-control-commands.d.ts","sourceRoot":"","sources":["../../../docx/ui/content-control-commands.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,EAAa,KAAK,IAAI,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC7F,OAAO,EAAiB,KAAK,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACtF,OAAO,EAWN,KAAK,aAAa,EAClB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAEN,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAIN,KAAK,WAAW,EAChB,MAAM,yBAAyB,CAAC;AAEjC,6FAA6F;AAC7F,eAAO,MAAM,iBAAiB,wBAAw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AAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC7C,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,mGAAmG;AACnG,wBAAgB,oBAAoB,CACnC,KAAK,EAAE,WAAW,EAClB,IAAI,EAAE,kBAAkB,EACxB,OAAO,GAAE,iBAAsB,GAC7B,WAAW,GAAG,SAAS,CAoCzB"}
1
+ {"version":3,"file":"content-control-commands.d.ts","sourceRoot":"","sources":["../../../docx/ui/content-control-commands.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,EAAa,KAAK,IAAI,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC7F,OAAO,EAAiB,KAAK,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACtF,OAAO,EAWN,KAAK,aAAa,EAClB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAEN,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAIN,KAAK,WAAW,EAChB,MAAM,yBAAyB,CAAC;AAEjC,6FAA6F;AAC7F,eAAO,MAAM,iBAAiB,wBAAwB,CAAC;AAsHvD;;;GAGG;AACH,wBAAgB,qBAAqB,CACpC,KAAK,EAAE,WAAW,EAClB,IAAI,EAAE,WAAW,EACjB,IAAI,EAAE,aAAa,GACjB,WAAW,CAyBb;AAmCD,sEAAsE;AACtE,wBAAgB,uBAAuB,CACtC,KAAK,EAAE,WAAW,EAClB,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,cAAc,GACrB,WAAW,CAiBb;AAgBD,wBAAgB,qBAAqB,CACpC,KAAK,EAAE,WAAW,EAClB,EAAE,EAAE,MAAM,EACV,EAAE,CAAC,EAAE,MAAM,GACT,WAAW,GAAG,SAAS,CA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.d.ts","sourceRoot":"","sources":["../../../docx/ui/content-control-guard.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAkG/E;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,UAAQ,GAAG,OAAO,CA2CjG;AAED,wBAAgB,oBAAoB,IAAI,MAAM,CAsD7C"}
1
+ {"version":3,"file":"content-control-guard.d.ts","sourceRoot":"","sources":["../../../docx/ui/content-control-guard.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAgJ/E;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,UAAQ,GAAG,OAAO,CAgDjG;AAED,wBAAgB,oBAAoB,IAAI,MAAM,CAsD7C"}
@@ -0,0 +1,17 @@
1
+ import type { Node as ProseMirrorNode } from 'prosemirror-model';
2
+ import type { RowControlSpan } from './content-control-rows.js';
3
+ import type { ControlSpan } from './content-control-spans.js';
4
+ export type Span = ControlSpan | RowControlSpan;
5
+ /** One control and its range: its spans, more than one when it holds what splits them. */
6
+ export interface Occurrence<S extends Span = Span> {
7
+ key: string;
8
+ spans: S[];
9
+ from: number;
10
+ to: number;
11
+ }
12
+ /**
13
+ * The occurrences of the controls `spans` hold, in document order: the spans of one level and id
14
+ * that go on with each other are one. `inline` is every inline span of `doc`, which can split one.
15
+ */
16
+ export declare function controlOccurrences<S extends Span>(doc: ProseMirrorNode, spans: readonly S[], inline: readonly Span[]): Occurrence<S>[];
17
+ //# sourceMappingURL=content-control-occurrences.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-control-occurrences.d.ts","sourceRoot":"","sources":["../../../docx/ui/content-control-occurrences.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D,MAAM,MAAM,IAAI,GAAG,WAAW,GAAG,cAAc,CAAC;AAEhD,0FAA0F;AAC1F,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,IAAI,GAAG,IAAI;IAChD,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACX;AAgCD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,IAAI,EAChD,GAAG,EAAE,eAAe,EACpB,KAAK,EAAE,SAAS,CAAC,EAAE,EACnB,MAAM,EAAE,SAAS,IAAI,EAAE,GACrB,UAAU,CAAC,CAAC,CAAC,EAAE,CAgBjB"}
@@ -1,10 +1,7 @@
1
1
  import type { EditorState, Transaction } from 'prosemirror-state';
2
- import { type RowControlSpan } from './content-control-rows.js';
3
- import { type ControlSpan } from './content-control-spans.js';
4
- type Span = ControlSpan | RowControlSpan;
2
+ import { type Span } from './content-control-occurrences.js';
5
3
  /** Takes the control of `span` off its text, paragraphs, table, cell or row; its content stays. */
6
4
  export declare function removeControl(tr: Transaction, span: Span): Transaction;
7
5
  /** The transaction removing every temporary control whose content `transactions` changed. */
8
6
  export declare function removeEditedTemporaryControls(transactions: readonly Transaction[], before: EditorState, after: EditorState): Transaction | null;
9
- export {};
10
7
  //# sourceMappingURL=content-control-temporary.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"content-control-temporary.d.ts","sourceRoot":"","sources":["../../../docx/ui/content-control-temporary.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIlE,OAAO,EAAmB,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,EAIN,KAAK,WAAW,EAChB,MAAM,yBAAyB,CAAC;AAGjC,KAAK,IAAI,GAAG,WAAW,GAAG,cAAc,CAAC;AAazC,mGAAmG;AACnG,wBAAgB,aAAa,CAAC,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,GAAG,WAAW,CA4BtE;AAuED,6FAA6F;AAC7F,wBAAgB,6BAA6B,CAC5C,YAAY,EAAE,SAAS,WAAW,EAAE,EACpC,MAAM,EAAE,WAAW,EACnB,KAAK,EAAE,WAAW,GAChB,WAAW,GAAG,IAAI,CAmDpB"}
1
+ {"version":3,"file":"content-control-temporary.d.ts","sourceRoot":"","sources":["../../../docx/ui/content-control-temporary.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIlE,OAAO,EAAuC,KAAK,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAgB/F,mGAAmG;AACnG,wBAAgB,aAAa,CAAC,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,GAAG,WAAW,CA4BtE;AAoBD,6FAA6F;AAC7F,wBAAgB,6BAA6B,CAC5C,YAAY,EAAE,SAAS,WAAW,EAAE,EACpC,MAAM,EAAE,WAAW,EACnB,KAAK,EAAE,WAAW,GAChB,WAAW,GAAG,IAAI,CAmDpB"}
@@ -1,3 +1,4 @@
1
+ import { Mark } from 'prosemirror-model';
1
2
  import { Plugin, type Transaction } from 'prosemirror-state';
2
3
  import type { DocumentProtection } from '../model.js';
3
4
  /**
@@ -13,12 +14,17 @@ export declare const isFormsProtected: (protection: DocumentProtection | undefin
13
14
  export declare function exceedsFormTextLength(tr: Transaction): boolean;
14
15
  /**
15
16
  * Whether every step of a transaction stays inside a form field, a content control or a section
16
- * the protection leaves editable.
17
+ * the protection leaves editable. `kept` are the marks the state keeps for the text typed next at
18
+ * its caret, `at`.
17
19
  */
18
- export declare function staysInFormFields(tr: Transaction): boolean;
20
+ export declare function staysInFormFields(tr: Transaction, kept?: {
21
+ marks: readonly Mark[];
22
+ at: number;
23
+ } | null): boolean;
19
24
  /**
20
- * Rejects local edits that a field's maximum length or the document's protection forbids, and
21
- * removes the en spaces of a blank text field that text was typed into.
25
+ * Rejects local edits that a field's maximum length or the document's protection forbids, removes
26
+ * the en spaces of a blank text field that text was typed into, and pastes into a protected text
27
+ * field's value as text in the formatting where it lands.
22
28
  */
23
29
  export declare function formFieldGuardPlugin(protection: () => DocumentProtection | undefined): Plugin;
24
30
  //# sourceMappingURL=form-field-guard.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"form-field-guard.d.ts","sourceRoot":"","sources":["../../../docx/ui/form-field-guard.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAa,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAUxE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAenD;;;GAGG;AACH,eAAO,MAAM,gBAAgB,eAAgB,kBAAkB,GAAG,SAAS,KAAG,OAChB,CAAC;AAE/D;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,WAAW,GAAG,OAAO,CAkB9D;AAsFD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,WAAW,GAAG,OAAO,CAuE1D;AAiCD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,kBAAkB,GAAG,SAAS,GAAG,MAAM,CAsC7F"}
1
+ {"version":3,"file":"form-field-guard.d.ts","sourceRoot":"","sources":["../../../docx/ui/form-field-guard.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAa,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAa,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AASxE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAmBnD;;;GAGG;AACH,eAAO,MAAM,gBAAgB,eAAgB,kBAAkB,GAAG,SAAS,KAAG,OAChB,CAAC;AAE/D;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,WAAW,GAAG,OAAO,CAkB9D;AAID;;;;GAIG;AACH,wBAAgB,iBAAiB,CAChC,EAAE,EAAE,WAAW,EACf,IAAI,CAAC,EAAE;IAAE,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,GAClD,OAAO,CAiFT;AAiCD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,kBAAkB,GAAG,SAAS,GAAG,MAAM,CAiD7F"}
@@ -0,0 +1,26 @@
1
+ import { type Node } from 'prosemirror-model';
2
+ import { type Step } from 'prosemirror-transform';
3
+ type Range = {
4
+ from: number;
5
+ to: number;
6
+ };
7
+ /**
8
+ * The sections a document protected for forms leaves editable (`w:formProt w:val="0"`), placed as
9
+ * Print Layout and the saved document place them: a section ends after the first block with its
10
+ * end id, the last section runs to the end of the document, and a section whose last block is
11
+ * gone is empty, its blocks falling to the next one (deleting a break merges sections).
12
+ */
13
+ export declare function unprotectedSections(doc: Node): Range[];
14
+ /**
15
+ * Whether a step leaves the unprotected sections where they were, mapped through it: no block
16
+ * moves into one of them or out of one. Content written at a section's start joins it, and at its
17
+ * end (but for the last section) the next one, as the sections are placed.
18
+ */
19
+ export declare function keepsSections(step: Step, before: Node, after: Node): boolean;
20
+ /**
21
+ * Whether the step only gives a paragraph or table another id, as the editor does to the copy a
22
+ * split makes of a paragraph: bookkeeping, not an edit, as long as no section moves with it.
23
+ */
24
+ export declare function renamesBlock(step: Step, before: Node | undefined, after: Node): boolean;
25
+ export {};
26
+ //# sourceMappingURL=form-protection-sections.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-protection-sections.d.ts","sourceRoot":"","sources":["../../../docx/ui/form-protection-sections.ts"],"names":[],"mappings":"AAEA,OAAO,EAAQ,KAAK,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAA+B,KAAK,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAE/E,KAAK,KAAK,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1C;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,IAAI,GAAG,KAAK,EAAE,CAiCtD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,GAAG,OAAO,CAQ5E;AAKD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,GAAG,SAAS,EAAE,KAAK,EAAE,IAAI,GAAG,OAAO,CAiBvF"}
@@ -0,0 +1,35 @@
1
+ import { Mark, Slice, type Node } from 'prosemirror-model';
2
+ import type { Transaction } from 'prosemirror-state';
3
+ import type { ReplaceStep } from 'prosemirror-transform';
4
+ import type { EditorView } from 'prosemirror-view';
5
+ type Range = {
6
+ from: number;
7
+ to: number;
8
+ };
9
+ /**
10
+ * Whether `from`..`to` lies in the value of an enabled text field outside `free` (the sections the
11
+ * protection leaves editable), its edges included.
12
+ */
13
+ export declare function inProtectedFormText(doc: Node, from: number, to: number, free: readonly Range[]): boolean;
14
+ /**
15
+ * Pastes `slice` as text in the formatting where it lands when the selection is in a protected
16
+ * text field's value, as ProseMirror pastes otherwise; false, and nothing done, elsewhere or when
17
+ * the clipboard held nothing the editor reads.
18
+ */
19
+ export declare function pasteIntoFormText(view: EditorView, slice: Slice, free: readonly Range[]): boolean;
20
+ /**
21
+ * Whether `step` writes text with formatting that neither the text it replaces nor the text beside
22
+ * it has, nor `stored` (the marks a deletion kept for the text typed next at the caret, given only
23
+ * for a step there): as text dropped into the value with formatting of its own does. Typed text
24
+ * takes the formatting where it lands.
25
+ */
26
+ export declare function writesFormatting(step: ReplaceStep, doc: Node, stored: readonly Mark[] | null): boolean;
27
+ /**
28
+ * Whether `tr`, changing nothing else, sets formatting for the text typed next (stored marks other
29
+ * than those at the caret) while the caret is in a protected text field's value, as Bold with no
30
+ * selection does. A deletion that keeps the marks of what it deleted for the text typed next is no
31
+ * such change.
32
+ */
33
+ export declare function storesFormatting(tr: Transaction, free: () => readonly Range[]): boolean;
34
+ export {};
35
+ //# sourceMappingURL=form-text-paste.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-text-paste.d.ts","sourceRoot":"","sources":["../../../docx/ui/form-text-paste.ts"],"names":[],"mappings":"AAGA,OAAO,EAAY,IAAI,EAAE,KAAK,EAAE,KAAK,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,KAAK,EAAe,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGnD,KAAK,KAAK,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1C;;;GAGG;AACH,wBAAgB,mBAAmB,CAClC,GAAG,EAAE,IAAI,EACT,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,SAAS,KAAK,EAAE,GACpB,OAAO,CAQT;AAwBD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,KAAK,EAAE,GAAG,OAAO,CAiBjG;AAMD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC/B,IAAI,EAAE,WAAW,EACjB,GAAG,EAAE,IAAI,EACT,MAAM,EAAE,SAAS,IAAI,EAAE,GAAG,IAAI,GAC5B,OAAO,CAcT;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,SAAS,KAAK,EAAE,GAAG,OAAO,CAKvF"}