@docx4j/core-ts 0.4.0 → 0.6.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/NOTICE +4 -0
- package/README.md +34 -3
- package/dist/html/convert.mjs +40 -15
- package/dist/html/elements.mjs +2 -1
- package/dist/model/color/ColorMath.d.mts +29 -0
- package/dist/model/color/ColorMath.mjs +146 -0
- package/dist/model/color/ColorTables.d.mts +6 -0
- package/dist/model/color/ColorTables.mjs +83 -0
- package/dist/model/color/DrawingMLColors.d.mts +52 -0
- package/dist/model/color/DrawingMLColors.mjs +374 -0
- package/dist/model/color/ResolvedColor.d.mts +36 -0
- package/dist/model/color/ResolvedColor.mjs +65 -0
- package/dist/model/color/SpreadsheetColors.d.mts +36 -0
- package/dist/model/color/SpreadsheetColors.mjs +84 -0
- package/dist/model/color/StyleFill.d.mts +28 -0
- package/dist/model/color/StyleFill.mjs +21 -0
- package/dist/model/color/ThemeColors.d.mts +86 -0
- package/dist/model/color/ThemeColors.mjs +304 -0
- package/dist/model/color/WordColors.d.mts +71 -0
- package/dist/model/color/WordColors.mjs +121 -0
- package/dist/model/color/index.d.mts +6 -0
- package/dist/model/color/index.mjs +30 -0
- package/dist/model/content/Body.d.mts +153 -19
- package/dist/model/content/Body.mjs +570 -131
- package/dist/model/content/Comment.d.mts +21 -3
- package/dist/model/content/Comment.mjs +202 -19
- package/dist/model/content/ContentControl.d.mts +197 -18
- package/dist/model/content/ContentControl.mjs +664 -95
- package/dist/model/content/Font.d.mts +67 -17
- package/dist/model/content/Font.mjs +114 -35
- package/dist/model/content/InlinePicture.d.mts +82 -7
- package/dist/model/content/InlinePicture.mjs +221 -28
- package/dist/model/content/List.mjs +13 -1
- package/dist/model/content/Paragraph.d.mts +213 -14
- package/dist/model/content/Paragraph.mjs +936 -100
- package/dist/model/content/Range.d.mts +242 -11
- package/dist/model/content/Range.mjs +975 -119
- package/dist/model/content/ResolvedView.d.mts +104 -0
- package/dist/model/content/ResolvedView.mjs +596 -0
- package/dist/model/content/Table.d.mts +29 -3
- package/dist/model/content/Table.mjs +109 -33
- package/dist/model/content/TrackedChange.d.mts +301 -16
- package/dist/model/content/TrackedChange.mjs +1284 -158
- package/dist/model/content/binder.d.mts +2 -1
- package/dist/model/content/binder.mjs +48 -1
- package/dist/model/content/comments.d.mts +20 -6
- package/dist/model/content/comments.mjs +67 -57
- package/dist/model/content/generalException.d.mts +18 -0
- package/dist/model/content/generalException.mjs +24 -0
- package/dist/model/content/index.d.mts +8 -3
- package/dist/model/content/index.mjs +7 -2
- package/dist/model/content/mathText.d.mts +21 -0
- package/dist/model/content/mathText.mjs +267 -0
- package/dist/model/content/officeText.d.mts +27 -0
- package/dist/model/content/officeText.mjs +74 -0
- package/dist/model/content/outline.d.mts +5 -0
- package/dist/model/content/outline.mjs +13 -0
- package/dist/model/content/placeholders.d.mts +110 -0
- package/dist/model/content/placeholders.mjs +253 -0
- package/dist/model/content/relationships.d.mts +30 -0
- package/dist/model/content/relationships.mjs +133 -0
- package/dist/model/content/search.d.mts +72 -0
- package/dist/model/content/search.mjs +204 -2
- package/dist/model/content/spanEdits.d.mts +159 -0
- package/dist/model/content/spanEdits.mjs +728 -0
- package/dist/model/content/story.d.mts +44 -0
- package/dist/model/content/story.mjs +92 -0
- package/dist/model/content/tableColumns.d.mts +1 -1
- package/dist/model/content/tableColumns.mjs +108 -80
- package/dist/model/content/tableRevisions.d.mts +11 -3
- package/dist/model/content/tableRevisions.mjs +72 -42
- package/dist/model/content/tableRules.d.mts +30 -0
- package/dist/model/content/tableRules.mjs +100 -0
- package/dist/model/content/textBoxes.d.mts +18 -0
- package/dist/model/content/textBoxes.mjs +105 -0
- package/dist/model/content/trackedChangeFilter.d.mts +39 -0
- package/dist/model/content/trackedChangeFilter.mjs +81 -0
- package/dist/model/content/tracking.d.mts +28 -0
- package/dist/model/content/tracking.mjs +149 -10
- package/dist/model/content/tree.d.mts +212 -13
- package/dist/model/content/tree.mjs +356 -35
- package/dist/model/customxml/CustomXmlPartCollection.d.mts +8 -0
- package/dist/model/customxml/CustomXmlPartCollection.mjs +34 -11
- package/dist/model/customxml/XmlMapping.d.mts +1 -1
- package/dist/model/customxml/XmlMapping.mjs +11 -0
- package/dist/model/customxml/bindings.d.mts +21 -2
- package/dist/model/customxml/bindings.mjs +76 -32
- package/dist/model/customxml/kinds.d.mts +8 -3
- package/dist/model/customxml/kinds.mjs +26 -5
- package/dist/model/customxml/picturePlaceholder.d.mts +17 -0
- package/dist/model/customxml/picturePlaceholder.mjs +32 -0
- package/dist/model/customxml/pictures.d.mts +9 -5
- package/dist/model/customxml/pictures.mjs +31 -13
- package/dist/model/customxml/xhtml.mjs +8 -2
- package/dist/model/fonts/families.generated.mjs +2 -2
- package/dist/model/fonts/registry.mjs +7 -1
- package/dist/model/fonts/substitutions.generated.mjs +2 -2
- package/dist/model/fonts/themes.generated.mjs +1 -1
- package/dist/model/index.d.mts +2 -0
- package/dist/model/index.mjs +4 -0
- package/dist/model/listnumbering/Emulator.d.mts +37 -5
- package/dist/model/listnumbering/Emulator.mjs +63 -9
- package/dist/model/listnumbering/definitions.mjs +18 -0
- package/dist/model/properties/PropertyResolver.d.mts +87 -7
- package/dist/model/properties/PropertyResolver.mjs +197 -17
- package/dist/model/properties/catalogue.d.mts +32 -4
- package/dist/model/properties/catalogue.mjs +115 -36
- package/dist/model/properties/log.d.mts +1 -1
- package/dist/model/properties/log.mjs +5 -5
- package/dist/model/properties/table.d.mts +16 -2
- package/dist/model/properties/table.mjs +17 -5
- package/dist/model/text/Extractor.d.mts +289 -0
- package/dist/model/text/Extractor.mjs +2162 -0
- package/dist/model/text/LinkTargets.d.mts +45 -0
- package/dist/model/text/LinkTargets.mjs +170 -0
- package/dist/model/text/MarkdownExporter.d.mts +140 -0
- package/dist/model/text/MarkdownExporter.mjs +255 -0
- package/dist/model/text/PlainText.d.mts +29 -0
- package/dist/model/text/PlainText.mjs +539 -0
- package/dist/model/text/TextContext.d.mts +161 -0
- package/dist/model/text/TextContext.mjs +425 -0
- package/dist/model/text/TextOptions.d.mts +150 -0
- package/dist/model/text/TextOptions.mjs +278 -0
- package/dist/model/text/TextResult.d.mts +504 -0
- package/dist/model/text/TextResult.mjs +526 -0
- package/dist/model/text/Texts.d.mts +99 -0
- package/dist/model/text/Texts.mjs +187 -0
- package/dist/model/text/WmlToMarkdown.d.mts +120 -0
- package/dist/model/text/WmlToMarkdown.mjs +911 -0
- package/dist/model/text/commonmark.d.mts +121 -0
- package/dist/model/text/commonmark.mjs +655 -0
- package/dist/model/text/index.d.mts +7 -0
- package/dist/model/text/index.mjs +8 -0
- package/dist/model/text/normalize.d.mts +8 -0
- package/dist/model/text/normalize.mjs +13 -0
- package/dist/model/text/outline.d.mts +4 -0
- package/dist/model/text/outline.mjs +71 -0
- package/dist/office-js/fragment.d.mts +7 -5
- package/dist/office-js/fragment.mjs +63 -14
- package/dist/office-js/proxy.d.mts +8 -0
- package/dist/office-js/proxy.mjs +29 -0
- package/dist/office-js/run.mjs +2 -0
- package/dist/office-js/supported.generated.mjs +16 -0
- package/dist/office-js/toApiScript.mjs +21 -5
- package/dist/opc/Load.d.mts +9 -2
- package/dist/opc/Save.d.mts +17 -0
- package/dist/opc/Save.mjs +12 -2
- package/dist/opc/index.d.mts +3 -3
- package/dist/opc/index.mjs +2 -2
- package/dist/opc/mce/preprocessor.d.mts +88 -7
- package/dist/opc/mce/preprocessor.mjs +144 -37
- package/dist/opc/mce/understood.d.mts +34 -0
- package/dist/opc/mce/understood.mjs +55 -3
- package/dist/packages/OpcPackage.d.mts +20 -0
- package/dist/packages/OpcPackage.mjs +16 -3
- package/dist/packages/WordprocessingMLPackage.d.mts +77 -7
- package/dist/packages/WordprocessingMLPackage.mjs +242 -11
- package/dist/parts/DefaultXmlPart.mjs +2 -2
- package/dist/parts/Part.d.mts +10 -2
- package/dist/parts/XmlPart.d.mts +35 -32
- package/dist/parts/XmlPart.mjs +107 -107
- package/dist/parts/wml/comments.mjs +30 -0
- package/dist/parts/wml/index.mjs +12 -0
- package/dist/xml/dom.d.mts +7 -0
- package/dist/xml/dom.mjs +18 -0
- package/package.json +2 -2
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { deepCopy, deepCopyAsSync } from '@docx4j/generated-objects-ts';
|
|
2
2
|
import * as el from '@docx4j/generated-objects-ts/el/org_docx4j_wml';
|
|
3
|
-
import { createCTTrackChange, createCTRPrChange, createCTRPrChangeRPr, createCTPPrChange, createCTMarkup, createDelText, createPPr, createParaRPr, createTrPr, } from '@docx4j/generated-objects-ts/factory/org_docx4j_wml';
|
|
3
|
+
import { createCTTrackChange, createCTRPrChange, createCTRPrChangeRPr, createCTPPrChange, createCTMarkup, createDelText, createPPr, createParaRPr, createTrPr, createParaRPrChange, createCTParaRPrOriginal, } from '@docx4j/generated-objects-ts/factory/org_docx4j_wml';
|
|
4
4
|
import { rPrToElements, rPrFromElements } from '@docx4j/generated-objects-ts/builders/wml';
|
|
5
5
|
import { Docx4JException } from '../../opc/exceptions.mjs';
|
|
6
|
-
import { W_NS, linkParents, walk, typeNameOf, revisionKindOf, childrenOf, rowsOf, cellsOf } from './tree.mjs';
|
|
6
|
+
import { W_NS, linkParents, walk, typeNameOf, revisionKindOf, childrenOf, rowsOf, cellsOf, isAlternateContent, selectedBranchOf, branchesOf, ALTERNATE_CONTENT } from './tree.mjs';
|
|
7
7
|
/**
|
|
8
8
|
* `w:id` on these is the one annotation id space (ECMA-376 17.13.5.4): revisions, bookmarks,
|
|
9
9
|
* comment range marks and permissions share it. `w:comment/@w:id` (docx4j `Comments.Comment`,
|
|
@@ -263,6 +263,31 @@ export class ChangeTracker {
|
|
|
263
263
|
if (Object.keys(rPr).every((key) => key === 'TYPE_NAME'))
|
|
264
264
|
delete run.rPr;
|
|
265
265
|
}
|
|
266
|
+
/**
|
|
267
|
+
* Records a paragraph mark's formatting as it is now in its `w:rPrChange`, once: what a tracked `font`
|
|
268
|
+
* write over a range holding the mark writes (check 52 case 56: `<w:rPrChange><w:rPr/></w:rPrChange>`
|
|
269
|
+
* for a mark that had no formatting). The mark's own revisions (inserted, deleted) are not its formatting.
|
|
270
|
+
*/
|
|
271
|
+
recordMarkRPrChange(rPr) {
|
|
272
|
+
if (rPr.rPrChange)
|
|
273
|
+
return;
|
|
274
|
+
const original = createCTParaRPrOriginal({ egrPrBase: rPrToElements(rPr) });
|
|
275
|
+
rPr.rPrChange = createParaRPrChange({ ...this.markup(), rPr: original });
|
|
276
|
+
linkParents(rPr.rPrChange, rPr);
|
|
277
|
+
}
|
|
278
|
+
/** `settleRPrChange` for a paragraph mark: its `w:rPrChange` goes where its formatting is back to what it recorded. */
|
|
279
|
+
settleMarkRPrChange(p) {
|
|
280
|
+
var _a, _b, _c;
|
|
281
|
+
const rPr = (_a = p.pPr) === null || _a === void 0 ? void 0 : _a.rPr;
|
|
282
|
+
const change = rPr === null || rPr === void 0 ? void 0 : rPr.rPrChange;
|
|
283
|
+
if (!rPr || !change)
|
|
284
|
+
return;
|
|
285
|
+
const { rPrChange: _recorded, ins: _ins, del: _del, moveFrom: _from, moveTo: _to, ...current } = rPr;
|
|
286
|
+
if (canonical(current) !== canonical(rPrFromElements((_c = (_b = change.rPr) === null || _b === void 0 ? void 0 : _b.egrPrBase) !== null && _c !== void 0 ? _c : [])))
|
|
287
|
+
return;
|
|
288
|
+
delete rPr.rPrChange;
|
|
289
|
+
pruneParagraphProperties(p);
|
|
290
|
+
}
|
|
266
291
|
/** Records the paragraph's properties as they are now in `w:pPrChange`, once. */
|
|
267
292
|
recordPPrChange(pPr) {
|
|
268
293
|
if (pPr.pPrChange)
|
|
@@ -373,11 +398,12 @@ export function wrapInsertedRuns(tracker, items, parent) {
|
|
|
373
398
|
/** A whole table inserted: every row is marked inserted and everything in its cells is an insertion (`trackInsertedBlocks`). */
|
|
374
399
|
export function trackInsertedTable(tracker, tbl) {
|
|
375
400
|
var _a;
|
|
376
|
-
|
|
401
|
+
// every branch of a kept row- or cell-level mc:AlternateContent (CR-013 phase 3)
|
|
402
|
+
for (const row of rowsOf(tbl, 'every')) {
|
|
377
403
|
const tr = row.element.value;
|
|
378
404
|
if (!((_a = tr.trPr) === null || _a === void 0 ? void 0 : _a.ins))
|
|
379
405
|
tracker.markRowInserted(tr);
|
|
380
|
-
for (const cell of cellsOf(tr))
|
|
406
|
+
for (const cell of cellsOf(tr, 'every'))
|
|
381
407
|
trackInsertedBlocks(tracker, childrenOf(cell.element.value));
|
|
382
408
|
}
|
|
383
409
|
}
|
|
@@ -398,6 +424,10 @@ export function trackInsertedBlock(tracker, block, owner) {
|
|
|
398
424
|
return;
|
|
399
425
|
else if (HOLDER_TYPES.has(tn !== null && tn !== void 0 ? tn : ''))
|
|
400
426
|
markHolderInserted(tracker, block, owner, () => trackInsertedBlocks(tracker, childrenOf(block.value)));
|
|
427
|
+
// a kept block-level mc:AlternateContent: every branch's content (CR-013 phase 3)
|
|
428
|
+
else if (tn === ALTERNATE_CONTENT)
|
|
429
|
+
for (const branch of branchesOf(block.value))
|
|
430
|
+
trackInsertedBlocks(tracker, branch);
|
|
401
431
|
else
|
|
402
432
|
trackInsertedBlocks(tracker, childrenOf(block.value));
|
|
403
433
|
}
|
|
@@ -443,6 +473,18 @@ export function holderItemsOf(value) {
|
|
|
443
473
|
* pairs, so that the ids run in document order as Word's do.
|
|
444
474
|
*/
|
|
445
475
|
export function markHolderInserted(tracker, holder, owner, inside) {
|
|
476
|
+
markHolder(tracker, holder, owner, inside, 'ins');
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* A content control or custom XML element deleted under tracking, as Word writes it (check 54 cases 15 and 17, a
|
|
480
|
+
* range across paragraphs holding a whole control): `markHolderInserted`'s form with `w:customXmlDelRangeStart` and
|
|
481
|
+
* `w:customXmlDelRangeEnd`, its content marked deleted between the two pairs (`inside`). Accepting takes the element
|
|
482
|
+
* away; rejecting, the markers (`TrackedChange`'s `holder` target).
|
|
483
|
+
*/
|
|
484
|
+
export function markHolderDeleted(tracker, holder, owner, inside) {
|
|
485
|
+
markHolder(tracker, holder, owner, inside, 'del');
|
|
486
|
+
}
|
|
487
|
+
function markHolder(tracker, holder, owner, inside, revision) {
|
|
446
488
|
var _a;
|
|
447
489
|
const at = owner.indexOf(holder);
|
|
448
490
|
const items = holderItemsOf(holder.value);
|
|
@@ -450,16 +492,17 @@ export function markHolderInserted(tracker, holder, owner, inside) {
|
|
|
450
492
|
inside();
|
|
451
493
|
return;
|
|
452
494
|
}
|
|
495
|
+
const [start, end] = revision === 'ins' ? [el.customXmlInsRangeStart, el.customXmlInsRangeEnd] : [el.customXmlDelRangeStart, el.customXmlDelRangeEnd];
|
|
453
496
|
const value = holder.value;
|
|
454
497
|
const first = tracker.markup();
|
|
455
|
-
const outerStart =
|
|
456
|
-
const innerEnd =
|
|
498
|
+
const outerStart = start(createCTTrackChange(first));
|
|
499
|
+
const innerEnd = end(createCTMarkup({ id: first.id }));
|
|
457
500
|
owner.splice(at, 0, outerStart);
|
|
458
501
|
items.unshift(innerEnd);
|
|
459
502
|
inside();
|
|
460
503
|
const second = tracker.markup();
|
|
461
|
-
const innerStart =
|
|
462
|
-
const outerEnd =
|
|
504
|
+
const innerStart = start(createCTTrackChange(second));
|
|
505
|
+
const outerEnd = end(createCTMarkup({ id: second.id }));
|
|
463
506
|
items.push(innerStart);
|
|
464
507
|
owner.splice(owner.indexOf(holder) + 1, 0, outerEnd);
|
|
465
508
|
linkParents([outerStart, outerEnd], value.PARENT);
|
|
@@ -505,6 +548,87 @@ export function markInserted(p) {
|
|
|
505
548
|
var _a, _b;
|
|
506
549
|
return ((_b = (_a = p.pPr) === null || _a === void 0 ? void 0 : _a.rPr) === null || _b === void 0 ? void 0 : _b.ins) !== undefined;
|
|
507
550
|
}
|
|
551
|
+
// --- an equation deleted (CR-002 section 62.2, D2) ----------------------------------------
|
|
552
|
+
/** Each equation structure's properties, whose `m:ctrlPr` marks the structure inserted or deleted (CR-002 section 51). */
|
|
553
|
+
const MATH_STRUCTURES = Object.fromEntries(['Acc', 'Bar', 'BorderBox', 'Box', 'D', 'EqArr', 'F', 'Func', 'GroupChr', 'LimLow', 'LimUpp', 'M', 'Nary', 'Phant', 'Rad', 'SPre', 'SSub', 'SSubSup', 'SSup']
|
|
554
|
+
.map((n) => [`org_docx4j_math.CT${n}`, `${n[0].toLowerCase()}${n.slice(1)}Pr`]));
|
|
555
|
+
/**
|
|
556
|
+
* An equation (`m:oMath`, `m:oMathPara`) marked deleted where it stands, in Word's form (check 57 cases 7 to 10): each
|
|
557
|
+
* math run's content inside a `w:del` in its `m:r`, and each structure's `m:ctrlPr` holding a `w:del` around its run
|
|
558
|
+
* properties, as Word's tracked `delete()` writes them. An argument's own `m:ctrlPr` marks no structure, and is left as
|
|
559
|
+
* it is. An equation holding a revision of its own (`equationRevisionIn`) is the caller's to put in a `w:del` whole.
|
|
560
|
+
*/
|
|
561
|
+
export function markEquationDeleted(tracker, equation) {
|
|
562
|
+
const visit = (value, depth) => {
|
|
563
|
+
var _a;
|
|
564
|
+
if (typeof value !== 'object' || value === null || depth > 64)
|
|
565
|
+
return;
|
|
566
|
+
if (Array.isArray(value)) {
|
|
567
|
+
for (const v of value)
|
|
568
|
+
visit(v, depth + 1);
|
|
569
|
+
return;
|
|
570
|
+
}
|
|
571
|
+
const named = value;
|
|
572
|
+
if (named.name !== undefined && 'value' in named) {
|
|
573
|
+
visit(named.value, depth + 1);
|
|
574
|
+
return;
|
|
575
|
+
}
|
|
576
|
+
const tn = (_a = value.TYPE_NAME) !== null && _a !== void 0 ? _a : '';
|
|
577
|
+
if (!tn.startsWith('org_docx4j_math.') || tn.endsWith('Pr'))
|
|
578
|
+
return;
|
|
579
|
+
if (tn === 'org_docx4j_math.CTR') {
|
|
580
|
+
deleteMathRun(tracker, value);
|
|
581
|
+
return;
|
|
582
|
+
}
|
|
583
|
+
const key = MATH_STRUCTURES[tn];
|
|
584
|
+
if (key !== undefined)
|
|
585
|
+
deleteMathStructure(tracker, value, tn, key);
|
|
586
|
+
for (const k of Object.keys(value))
|
|
587
|
+
if (k !== 'PARENT' && k !== 'TYPE_NAME' && k !== key)
|
|
588
|
+
visit(value[k], depth + 1);
|
|
589
|
+
};
|
|
590
|
+
visit(equation, 0);
|
|
591
|
+
}
|
|
592
|
+
/** A math run's content moved into a `w:del` in it (`CT_MathRunTrackChange`), its `m:t` kept as `m:t`, as Word writes it. */
|
|
593
|
+
function deleteMathRun(tracker, run) {
|
|
594
|
+
var _a;
|
|
595
|
+
const content = ((_a = run.content) !== null && _a !== void 0 ? _a : (run.content = []));
|
|
596
|
+
const value = { TYPE_NAME: 'org_docx4j_wml.CTMathRunTrackChange', ...tracker.markup(), rest: content.splice(0) };
|
|
597
|
+
const del = element('del', value);
|
|
598
|
+
linkParents(value.rest, value);
|
|
599
|
+
content.push(del);
|
|
600
|
+
linkParents(del, run);
|
|
601
|
+
}
|
|
602
|
+
/** A structure's `m:ctrlPr` holding a `w:del` with the run properties it had, its properties made where it had none. */
|
|
603
|
+
function deleteMathStructure(tracker, structure, tn, key) {
|
|
604
|
+
var _a, _b;
|
|
605
|
+
const properties = ((_a = structure[key]) !== null && _a !== void 0 ? _a : (structure[key] = { TYPE_NAME: `${tn}Pr` }));
|
|
606
|
+
const ctrlPr = ((_b = properties.ctrlPr) !== null && _b !== void 0 ? _b : (properties.ctrlPr = { TYPE_NAME: 'org_docx4j_math.CTCtrlPr' }));
|
|
607
|
+
const rPr = createCTRPrChangeRPr({ egrPrBase: ctrlPr.rPr ? rPrToElements(ctrlPr.rPr) : [] });
|
|
608
|
+
ctrlPr.del = createCTRPrChange({ ...tracker.markup(), rPr });
|
|
609
|
+
delete ctrlPr.rPr;
|
|
610
|
+
linkParents(properties, structure);
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* A revision an equation holds of its own, or undefined: a math run's, a structure's or an argument's, or a `w:ins` or
|
|
614
|
+
* `w:del` among its runs. How Word deletes such an equation isn't measured, so a tracked deletion puts it whole in a
|
|
615
|
+
* `w:del`, the form this package wrote for every equation before (CR-002 section 62.2, D2).
|
|
616
|
+
*/
|
|
617
|
+
export function equationRevisionIn(equation) {
|
|
618
|
+
let found;
|
|
619
|
+
walk(equation, (value) => {
|
|
620
|
+
if (found)
|
|
621
|
+
return;
|
|
622
|
+
const tn = value.TYPE_NAME;
|
|
623
|
+
if (tn === 'org_docx4j_wml.CTMathRunTrackChange')
|
|
624
|
+
found = 'a math run\'s revision';
|
|
625
|
+
else if (tn === 'org_docx4j_wml.RunIns' || tn === 'org_docx4j_wml.RunDel' || tn === 'org_docx4j_wml.RunTrackChange')
|
|
626
|
+
found = 'a revision among its runs';
|
|
627
|
+
else if (tn === 'org_docx4j_math.CTCtrlPr' && (value.ins || value.del))
|
|
628
|
+
found = 'a structure\'s revision';
|
|
629
|
+
});
|
|
630
|
+
return found;
|
|
631
|
+
}
|
|
508
632
|
// --- w:t <-> w:delText -------------------------------------------------------------------
|
|
509
633
|
const DELETED_NAME = { t: 'delText', instrText: 'delInstrText' };
|
|
510
634
|
const RESTORED_NAME = { delText: 't', delInstrText: 'instrText' };
|
|
@@ -517,11 +641,26 @@ export function toRestoredText(run) {
|
|
|
517
641
|
rename(run, RESTORED_NAME, false);
|
|
518
642
|
}
|
|
519
643
|
function rename(run, table, deleting) {
|
|
520
|
-
|
|
644
|
+
renameIn(run.content, run, table, deleting);
|
|
645
|
+
}
|
|
646
|
+
/**
|
|
647
|
+
* `rename` over a run's items, and over a kept `mc:AlternateContent`'s selected branch among them: a
|
|
648
|
+
* deletion of a branch's text writes the selected branch's `w:delText` and keeps the other branches as
|
|
649
|
+
* they were (CR-012 section 12.2, the editor's ED-009 section 3.6).
|
|
650
|
+
*/
|
|
651
|
+
function renameIn(content, parent, table, deleting) {
|
|
652
|
+
var _a, _b, _c;
|
|
521
653
|
if (!content)
|
|
522
654
|
return;
|
|
523
655
|
for (let i = 0; i < content.length; i++) {
|
|
524
656
|
const item = content[i];
|
|
657
|
+
if (isAlternateContent(item)) {
|
|
658
|
+
const branch = selectedBranchOf(item.value);
|
|
659
|
+
const holder = branch === undefined ? undefined : ((_c = (_b = (_a = branch[0]) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.PARENT) !== null && _c !== void 0 ? _c : parent);
|
|
660
|
+
if (branch && holder)
|
|
661
|
+
renameIn(branch, holder, table, deleting);
|
|
662
|
+
continue;
|
|
663
|
+
}
|
|
525
664
|
const to = table[item.name.localPart];
|
|
526
665
|
if (to === undefined)
|
|
527
666
|
continue;
|
|
@@ -530,7 +669,7 @@ function rename(run, table, deleting) {
|
|
|
530
669
|
? createDelText({ value: v.value, ...(v.space === undefined ? {} : { space: v.space }) })
|
|
531
670
|
: { TYPE_NAME: 'org_docx4j_wml.Text', value: v.value, ...(v.space === undefined ? {} : { space: v.space }) };
|
|
532
671
|
content[i] = element(to, value);
|
|
533
|
-
linkParents(content[i],
|
|
672
|
+
linkParents(content[i], parent);
|
|
534
673
|
}
|
|
535
674
|
}
|
|
536
675
|
// --- w:rPr <-> w:rPrChange/w:rPr ---------------------------------------------------------
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type * as wml from '@docx4j/generated-objects-ts/modules/org_docx4j_wml';
|
|
2
|
+
import type * as mce from '@docx4j/generated-objects-ts/modules/org_docx4j_mce';
|
|
2
3
|
import { isElement, runItemsOf, type Element } from '@docx4j/generated-objects-ts/builders/wml';
|
|
3
4
|
export { isElement, typeNameOf, walk, find, linkParents, textOf, W_NS, type Element } from '@docx4j/generated-objects-ts/builders/wml';
|
|
4
5
|
/** The two views of a tracked document: as it will read once accepted, or as it read before the changes. */
|
|
@@ -7,6 +8,78 @@ export interface TextViewOptions {
|
|
|
7
8
|
/** 'accepted' (the default: w:ins included, w:del excluded) or 'original' (the other way). */
|
|
8
9
|
view?: TextView;
|
|
9
10
|
}
|
|
11
|
+
/** Whether a run is hidden: its effective `w:vanish` (`hiddenRunsOf` makes one for a paragraph). */
|
|
12
|
+
export type HiddenRuns = (run: wml.R) => boolean;
|
|
13
|
+
/** `segmentsOf`'s options: a view, whether drawn objects get a segment of their own, which runs are hidden. */
|
|
14
|
+
export interface SegmentOptions extends TextViewOptions {
|
|
15
|
+
/**
|
|
16
|
+
* True to list each picture or other drawn object (`OBJECT_ITEMS`) as a segment of no text at its
|
|
17
|
+
* place in the text (`object` set), so that a deletion of a span can find it (CR-002 section 48).
|
|
18
|
+
* Hidden runs' items are listed with them.
|
|
19
|
+
*/
|
|
20
|
+
objects?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Which runs are hidden. Office JS's text leaves hidden text out, a run's own `w:vanish` or its
|
|
23
|
+
* styles' (check 48b), so `Paragraph.text` does too (CR-012 phase 4): a hidden run's items take no
|
|
24
|
+
* offset, and are listed only with the objects, each `object` and `hidden`, so that a span's deletion
|
|
25
|
+
* takes the hidden text strictly inside it as it takes a picture. Undefined: no run is hidden.
|
|
26
|
+
*/
|
|
27
|
+
hidden?: HiddenRuns;
|
|
28
|
+
/**
|
|
29
|
+
* Called for every element the walk passes that adds no text: each element of a run holder's list
|
|
30
|
+
* (runs, revision holders, markers, before it is entered) and each item of a run that adds none (a
|
|
31
|
+
* comment reference, a field character, a drawing, a hidden run's text), with the offset it stands at,
|
|
32
|
+
* the list holding it and its run. What gives a comment marker or a revision its offset in the same text.
|
|
33
|
+
*/
|
|
34
|
+
visit?: (item: Element, at: number, owner: Element[], run: {
|
|
35
|
+
element: Element<wml.R>;
|
|
36
|
+
owner: Element[];
|
|
37
|
+
} | undefined) => void;
|
|
38
|
+
/**
|
|
39
|
+
* `office` (the default): Office JS's characters (`officeItemText`), a kept `mc:AlternateContent`'s
|
|
40
|
+
* selected branch read, an equation's drawn text. `textOf`: the characters of the objects package's
|
|
41
|
+
* `textOf` and docx4j's `TextUtils`, as this function read before CR-012 phase 4 (a break `\n`, the
|
|
42
|
+
* hyphens U+2011 and U+00AD, a symbol its code point, a note reference nothing), a run-level element
|
|
43
|
+
* one object, a paragraph-level one and an equation nothing: what a tracked change's `text` is, which
|
|
44
|
+
* the revisions goldens hold to docx4j's.
|
|
45
|
+
*/
|
|
46
|
+
characters?: 'office' | 'textOf';
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Run content that stands in the text and has no text of its own: a `w:drawing` (a picture, a chart, a
|
|
50
|
+
* text box), a VML `w:pict` and an embedded `w:object`. Office JS counts an inline picture as in a
|
|
51
|
+
* range, so a span's deletion takes the objects in it (CR-002 section 48). A kept `mc:AlternateContent`
|
|
52
|
+
* in a run is one such object too, whatever its branches hold (`ALTERNATE_CONTENT`, CR-010 phase 3).
|
|
53
|
+
*/
|
|
54
|
+
export declare const OBJECT_ITEMS: ReadonlySet<string>;
|
|
55
|
+
/** The TYPE_NAME of a kept `mc:AlternateContent` (the default load since CR-010 phase 4; under `KEPT_HOSTS` with `mcePreprocess: true`). */
|
|
56
|
+
export declare const ALTERNATE_CONTENT = "org_docx4j_mce.AlternateContent";
|
|
57
|
+
/**
|
|
58
|
+
* The branch of a kept `mc:AlternateContent` the content API reads (docx4j's `McMode.READ`, CR-010
|
|
59
|
+
* phase 3): the objects package's `mcBranchOf` over `READ_UNDERSTOOD_PREFIXES`, the prefixes load
|
|
60
|
+
* understands and the four Word 365 understands that load leaves alone (CR-010 section 15). So a reader
|
|
61
|
+
* takes the branch the preprocessor would have resolved the element to, unless a Choice requires one of
|
|
62
|
+
* those four: then it takes that Choice, as Word does, where a resolved load takes the next one or the
|
|
63
|
+
* Fallback. A mutator walks every branch instead (docx4j's `McMode.ALL`). Undefined for an element with
|
|
64
|
+
* no branches.
|
|
65
|
+
*/
|
|
66
|
+
export declare function selectedBranchOf(value: mce.AlternateContent | undefined): Element[] | undefined;
|
|
67
|
+
/** True for a kept `mc:AlternateContent`: its element pair, or its value. */
|
|
68
|
+
export declare function isAlternateContent(value: unknown): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Which objects at a span's edges are in the span. An object stands between two characters, so one at
|
|
71
|
+
* a span's start or end offset may be inside it or outside it, and offsets alone cannot say which. A
|
|
72
|
+
* paragraph's whole range holds the objects at both of its edges (`WHOLE`); a span of text, such as a
|
|
73
|
+
* search found, holds only the objects strictly inside it (CR-002 section 48).
|
|
74
|
+
*/
|
|
75
|
+
export interface SpanEdges {
|
|
76
|
+
start: boolean;
|
|
77
|
+
end: boolean;
|
|
78
|
+
}
|
|
79
|
+
/** Both edges: the objects at a span's start and at its end are in it. */
|
|
80
|
+
export declare const WHOLE: SpanEdges;
|
|
81
|
+
/** True when an object at offset `at` is in the span [start, end) with these edges. */
|
|
82
|
+
export declare function objectInSpan(at: number, start: number, end: number, edges?: SpanEdges): boolean;
|
|
10
83
|
/** The four run-level revision holders (CR-002 phase F); their runs live under `customXmlOrSmartTagOrSdt`. */
|
|
11
84
|
export type RevisionKind = 'ins' | 'del' | 'moveFrom' | 'moveTo';
|
|
12
85
|
/** The run-level revision a run sits in. */
|
|
@@ -37,44 +110,170 @@ export interface TextSegment {
|
|
|
37
110
|
end: number;
|
|
38
111
|
/** True for w:t: text that can be edited in place. */
|
|
39
112
|
editable: boolean;
|
|
113
|
+
/** True for a drawn object (`OBJECT_ITEMS`, or a kept `mc:AlternateContent`), whose segment has no text: listed only when asked for. */
|
|
114
|
+
object?: boolean;
|
|
40
115
|
/**
|
|
41
116
|
* The nearest enclosing w:ins / w:del / w:moveFrom / w:moveTo, when the run is in one.
|
|
42
117
|
* A deletion of this run goes inside it (`runOwner` is already its item list); an insertion
|
|
43
118
|
* next to it goes beside it (`revision.owner`) unless the same author may extend it.
|
|
44
119
|
*/
|
|
45
120
|
revision?: RevisionHolder;
|
|
121
|
+
/**
|
|
122
|
+
* An item of a hidden run (`SegmentOptions.hidden`): no text, listed with the objects, `object` set too;
|
|
123
|
+
* a drawing in a hidden run is one (Word's default view doesn't show it: `search`'s `^g` passes it by).
|
|
124
|
+
*/
|
|
125
|
+
hidden?: boolean;
|
|
126
|
+
/**
|
|
127
|
+
* An equation (`m:oMath`, `m:oMathPara`): one segment holding its text as Word draws it
|
|
128
|
+
* (`mathTextOf`). `item` is the equation and `owner` the list holding it, as `runOwner` is; `run`
|
|
129
|
+
* is a frozen stand-in, since an equation is in no run. An edit may take it whole, not in part.
|
|
130
|
+
*/
|
|
131
|
+
math?: boolean;
|
|
132
|
+
/**
|
|
133
|
+
* The kept `mc:AlternateContent` whose selected branch holds this item (a run-level element) or its
|
|
134
|
+
* run (a paragraph-level one), the innermost: an edit lands in that branch, the others kept as they
|
|
135
|
+
* were read (CR-012 section 12.2).
|
|
136
|
+
*/
|
|
137
|
+
alternate?: AlternateLocation;
|
|
138
|
+
}
|
|
139
|
+
/** Where a kept `mc:AlternateContent` whose selected branch holds text stands (CR-012 section 12.2). */
|
|
140
|
+
export interface AlternateLocation {
|
|
141
|
+
/** The element pair. */
|
|
142
|
+
element: Element;
|
|
143
|
+
/** The array holding it: a run's content (`run` level) or a run holder's list (`paragraph` level). */
|
|
144
|
+
owner: Element[];
|
|
145
|
+
/** Its selected branch's items (`selectedBranchOf`). */
|
|
146
|
+
branch: Element[];
|
|
147
|
+
/** `run`: the element is run content and its branch holds run items; `paragraph`: it stands among runs and its branch holds runs. */
|
|
148
|
+
level: 'run' | 'paragraph';
|
|
46
149
|
}
|
|
47
150
|
/** Types whose value holds runs (directly or through sdtContent); the revision holders are separate. */
|
|
48
151
|
declare const RUN_HOLDERS: Set<string>;
|
|
49
152
|
/** The kind of a run-level revision element, by its name; undefined when it is not one. */
|
|
50
153
|
export declare function revisionKindOf(el: Element): RevisionKind | undefined;
|
|
51
154
|
export { runItemsOf };
|
|
155
|
+
/**
|
|
156
|
+
* An item's text in Office JS's text, Word's own character stream (CR-012 phase 4; check 48, Word 365):
|
|
157
|
+
* a `w:br` U+000B, of type page U+000C and column U+000E; a `w:cr` U+000D; a `w:ptab` `0`; the
|
|
158
|
+
* non-breaking and optional hyphens U+001E and U+001F; any `w:sym` `(`, whatever its font or code
|
|
159
|
+
* (check 48b); a footnote or endnote reference U+0002, and so the note's own mark (`w:footnoteRef`,
|
|
160
|
+
* `w:endnoteRef`, not measured). Undefined for an item that adds no text: a comment reference, a
|
|
161
|
+
* field's characters and code, a drawing.
|
|
162
|
+
*/
|
|
163
|
+
export declare function officeItemText(item: Element): string | undefined;
|
|
164
|
+
/**
|
|
165
|
+
* The item text the revision listings and the text model's plan count (`itemTextOf`): whether a run
|
|
166
|
+
* holds text, in the characters `textOf` gives. Not Office JS's (`officeItemText`).
|
|
167
|
+
*/
|
|
52
168
|
declare function itemText(item: Element): string | undefined;
|
|
53
169
|
/**
|
|
54
|
-
* The text segments of a paragraph (or any run holder) in order
|
|
55
|
-
* accepted one: the runs of a `w:ins` or `w:moveTo`
|
|
56
|
-
* do not. `{ view: 'original' }` is the other way round
|
|
170
|
+
* The text segments of a paragraph (or any run holder) in order, in Office JS's characters
|
|
171
|
+
* (`officeItemText`). The default view is the accepted one: the runs of a `w:ins` or `w:moveTo`
|
|
172
|
+
* count, those of a `w:del` or `w:moveFrom` do not. `{ view: 'original' }` is the other way round
|
|
173
|
+
* (CR-002 phase F). `{ objects: true }` lists the drawn objects too, each a segment of no text where
|
|
174
|
+
* it stands (CR-002 section 48), and the items of hidden runs (`hidden`).
|
|
175
|
+
*
|
|
176
|
+
* A kept `mc:AlternateContent` reads as its selected branch (CR-012 section 12.2, ED-009): in a run,
|
|
177
|
+
* a branch holding run items reads as those items, at the run's offsets, and one holding a drawing,
|
|
178
|
+
* a picture or an object is one object segment, as a drawing is (CR-010 phase 3); among a paragraph's
|
|
179
|
+
* runs, it reads as the runs its branch holds. Either way the segments carry `alternate`, so that an
|
|
180
|
+
* edit lands in that branch. An equation is one segment of its drawn text (`math`).
|
|
181
|
+
*/
|
|
182
|
+
export declare function segmentsOf(container: object, options?: SegmentOptions): TextSegment[];
|
|
183
|
+
/** What `hiddenRunsOf` asks of a `PropertyResolver`. */
|
|
184
|
+
export interface VanishResolver {
|
|
185
|
+
isVanishedByStyles(paragraphStyleId: string | undefined, runStyleId: string | undefined): boolean;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Which of a paragraph's runs are hidden, as the text model's rule has it (REQ-507) and Office JS's text
|
|
189
|
+
* leaves them out (check 48b): a run's own `w:vanish`, else its paragraph style's and character style's.
|
|
190
|
+
* Without a resolver only a run's own counts.
|
|
191
|
+
*/
|
|
192
|
+
export declare function hiddenRunsOf(resolver: VanishResolver | undefined, p: wml.P): HiddenRuns;
|
|
193
|
+
/**
|
|
194
|
+
* Whether a run is in a content control showing its placeholder (`w:showingPlcHdr`), run-level or block-level, up its
|
|
195
|
+
* `PARENT`s. Office JS reads a placeholder as no text, and finds no text there to keep (check 53 cases 34 and 35, check 58
|
|
196
|
+
* cases 11 and 12; CR-012 section 18), so the readers take its runs as they take hidden ones.
|
|
197
|
+
*/
|
|
198
|
+
export declare function inShowingPlaceholder(run: object): boolean;
|
|
199
|
+
/** The text of a paragraph or container in one of the two views, in Office JS's characters (`segmentsOf`). */
|
|
200
|
+
export declare function textOfView(container: object, options?: SegmentOptions): string;
|
|
201
|
+
/**
|
|
202
|
+
* The runs of a paragraph, direct and nested in hyperlinks, content controls and insertions, in order,
|
|
203
|
+
* and in the selected branch of a kept `mc:AlternateContent` among them (CR-012 section 12.2).
|
|
57
204
|
*/
|
|
58
|
-
export declare function segmentsOf(container: object, options?: TextViewOptions): TextSegment[];
|
|
59
|
-
/** The text of a paragraph or container in one of the two views (`textOf` is the accepted one). */
|
|
60
|
-
export declare function textOfView(container: object, options?: TextViewOptions): string;
|
|
61
|
-
/** The runs of a paragraph, direct and nested in hyperlinks, content controls and insertions, in order. */
|
|
62
205
|
export declare function runsOf(container: object, options?: TextViewOptions): Element<wml.R>[];
|
|
206
|
+
/** The TYPE_NAMEs of a kept `mc:AlternateContent`'s branches, whose items are their `any`. */
|
|
207
|
+
export declare const BRANCH_TYPES: ReadonlySet<string>;
|
|
208
|
+
/**
|
|
209
|
+
* How a walk takes a kept `mc:AlternateContent` among blocks, rows or cells (CR-013): `'read'`, a reader's,
|
|
210
|
+
* its selected branch (`selectedBranchOf`), as Word reads it; `'every'`, a mutator's, every branch, Choices
|
|
211
|
+
* first (phase 3). With no mode the element is stepped over, as every walk did before CR-013 phase 2.
|
|
212
|
+
*/
|
|
213
|
+
export type BranchMode = 'read' | 'every';
|
|
63
214
|
/**
|
|
64
215
|
* The block-level children of a container: body, header, footer, cell, sdt content, table (rows),
|
|
65
216
|
* row (cells). A content control of any kind (block, row, cell, run) answers with its
|
|
66
|
-
* `sdtContent`'s content, so that a traversal does not have to know the four types.
|
|
217
|
+
* `sdtContent`'s content, so that a traversal does not have to know the four types. A branch of a kept
|
|
218
|
+
* `mc:AlternateContent` (a Choice or the Fallback) answers with its items, so that a locator climbing
|
|
219
|
+
* `PARENT` from a branch's paragraph, row or cell finds the list it is in; the element itself answers
|
|
220
|
+
* in a reader's walk (`'read'`) with its selected branch (CR-013 phase 2), and otherwise not at all.
|
|
221
|
+
*/
|
|
222
|
+
export declare function childrenOf(value: object, mode?: 'read'): Element[] | undefined;
|
|
223
|
+
/** Every branch of a kept `mc:AlternateContent`, the Choices in order, then the Fallback. */
|
|
224
|
+
export declare function branchesOf(value: mce.AlternateContent): Element[][];
|
|
225
|
+
/**
|
|
226
|
+
* Runs a bulk edit that reaches every branch of a kept `mc:AlternateContent` (CR-013 phase 3): a
|
|
227
|
+
* `replaceText`, a tracked clear or row deletion, the binding passes. Inside it the views it makes of
|
|
228
|
+
* what is in a branch write, where a caller's view refuses (D4): the edit itself reaches every branch,
|
|
229
|
+
* the selected one and the others alike, as CR-010's rule has mutators do.
|
|
230
|
+
*/
|
|
231
|
+
export declare function writingEveryBranch<T>(edit: () => T): T;
|
|
232
|
+
/**
|
|
233
|
+
* Refuses a write through a view in a branch of a kept `mc:AlternateContent` at block, row or cell level
|
|
234
|
+
* (CR-013 D4): the view reads the selected branch, and a write would have to reach the element's other
|
|
235
|
+
* branches too, which nothing maps. A bulk edit reaching every branch writes there (`writingEveryBranch`).
|
|
236
|
+
* `className` is Office JS's ('Paragraph', 'Body').
|
|
237
|
+
*/
|
|
238
|
+
export declare function assertOutsideBranch(value: object | undefined, className: string, what?: string): void;
|
|
239
|
+
/**
|
|
240
|
+
* True for a value inside a branch of a kept `mc:AlternateContent` at block, row or cell level: a
|
|
241
|
+
* paragraph, table, row, cell or content control a reader sees in the selected branch (CR-013 phase 2).
|
|
242
|
+
* A view of one is read-only (D4). From `PARENT` links; a run-level element's content is not reached
|
|
243
|
+
* from a paragraph, which is outside it.
|
|
244
|
+
*/
|
|
245
|
+
export declare function inBranch(value: object | undefined): boolean;
|
|
246
|
+
/**
|
|
247
|
+
* True for a value no reader sees: inside a branch of a kept `mc:AlternateContent` other than the one
|
|
248
|
+
* `selectedBranchOf` takes, at any depth (CR-013 phase 3). What a bulk edit writes there it does not
|
|
249
|
+
* count, as resolve-all counts the listed changes: the count is of what a reader sees.
|
|
67
250
|
*/
|
|
68
|
-
export declare function
|
|
251
|
+
export declare function inUnreadBranch(value: object | undefined): boolean;
|
|
252
|
+
/**
|
|
253
|
+
* The lists a walk takes for a kept `mc:AlternateContent` among blocks, rows or cells: a reader's
|
|
254
|
+
* (`'read'`) its selected branch, a mutator's (`'every'`) every branch, the Choices first.
|
|
255
|
+
*/
|
|
256
|
+
export declare function branchListsOf(value: mce.AlternateContent, mode: BranchMode): Element[][];
|
|
69
257
|
/** An element with the array that holds it: what a view needs to edit it in place. */
|
|
70
258
|
export interface Located<T = unknown> {
|
|
71
259
|
element: Element<T>;
|
|
72
260
|
container: Element[];
|
|
73
261
|
}
|
|
74
|
-
/**
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
262
|
+
/**
|
|
263
|
+
* The rows of a table, in order, descending into row-level content controls (an OpenDoPE repeat), and,
|
|
264
|
+
* with a mode, into a row-level `mc:AlternateContent` (`BranchMode`; CR-013 phase 2).
|
|
265
|
+
*/
|
|
266
|
+
export declare function rowsOf(tbl: object, mode?: BranchMode): Located<wml.Tr>[];
|
|
267
|
+
/** The cells of a row, in order, descending into cell-level content controls, and with a mode into a cell-level `mc:AlternateContent`. */
|
|
268
|
+
export declare function cellsOf(tr: object, mode?: BranchMode): Located<wml.Tc>[];
|
|
269
|
+
/**
|
|
270
|
+
* A row's cells as laid along the grid, one list per reading of the row (docx4j's `Lister.cellLayoutsOf`,
|
|
271
|
+
* its CR-051 phase 2): the selected branches' first (`cellsOf(tr, 'read')`), then, for each cell-level
|
|
272
|
+
* `mc:AlternateContent` and each of its other branches, the row read with that branch in the element's
|
|
273
|
+
* place. Every branch spans the same grid columns, so every cell is in some list at its grid position:
|
|
274
|
+
* what a pass over the grid's columns walks (`collapseGrid`, the column passes; CR-013 phase 3).
|
|
275
|
+
*/
|
|
276
|
+
export declare function cellLayoutsOf(tr: object): Located<wml.Tc>[][];
|
|
78
277
|
/** Content controls: `w:sdt` at block, row, cell and run level, by TYPE_NAME. */
|
|
79
278
|
export declare const SDT_TYPES: Set<string>;
|
|
80
279
|
/** True for what a body or cell may hold directly (the Body content union), by TYPE_NAME. */
|