@docx4j/core-ts 0.5.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 +32 -4
- package/dist/html/convert.mjs +2 -1
- 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 +145 -23
- package/dist/model/content/Body.mjs +509 -141
- package/dist/model/content/Comment.d.mts +21 -3
- package/dist/model/content/Comment.mjs +195 -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 +11 -0
- package/dist/model/content/InlinePicture.mjs +21 -1
- package/dist/model/content/List.mjs +3 -0
- package/dist/model/content/Paragraph.d.mts +189 -13
- package/dist/model/content/Paragraph.mjs +870 -74
- package/dist/model/content/Range.d.mts +227 -12
- package/dist/model/content/Range.mjs +785 -59
- 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 +172 -13
- package/dist/model/content/TrackedChange.mjs +728 -167
- 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/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 +171 -22
- package/dist/model/content/tree.mjs +329 -53
- 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 +4 -3
- package/dist/model/customxml/pictures.mjs +18 -6
- package/dist/model/customxml/xhtml.mjs +8 -2
- 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/properties/PropertyResolver.d.mts +60 -1
- package/dist/model/properties/PropertyResolver.mjs +115 -2
- package/dist/model/properties/catalogue.d.mts +19 -5
- package/dist/model/properties/catalogue.mjs +41 -15
- package/dist/model/properties/log.d.mts +1 -1
- package/dist/model/properties/log.mjs +5 -5
- package/dist/model/properties/table.mjs +4 -2
- 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/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 +1 -1
- package/dist/opc/mce/preprocessor.d.mts +28 -3
- package/dist/opc/mce/preprocessor.mjs +4 -4
- package/dist/opc/mce/understood.d.mts +30 -6
- package/dist/opc/mce/understood.mjs +37 -7
- package/dist/packages/OpcPackage.d.mts +13 -0
- package/dist/packages/OpcPackage.mjs +1 -0
- package/dist/packages/WordprocessingMLPackage.d.mts +45 -8
- package/dist/packages/WordprocessingMLPackage.mjs +155 -20
- package/dist/parts/DefaultXmlPart.mjs +2 -2
- package/dist/parts/Part.d.mts +10 -2
- package/dist/parts/XmlPart.d.mts +12 -30
- package/dist/parts/XmlPart.mjs +44 -93
- 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
|
@@ -2,11 +2,11 @@ import type * as wml from '@docx4j/generated-objects-ts/modules/org_docx4j_wml';
|
|
|
2
2
|
import type { PropertyResolver } from '../properties/PropertyResolver.mjs';
|
|
3
3
|
import type { XmlPart } from '../../parts/XmlPart.mjs';
|
|
4
4
|
import type { OpcPackage } from '../../packages/OpcPackage.mjs';
|
|
5
|
-
import { type Element, type TextViewOptions } from './tree.mjs';
|
|
5
|
+
import { type Element, type TextViewOptions, type HiddenRuns, type BranchMode } from './tree.mjs';
|
|
6
6
|
import { Paragraph } from './Paragraph.mjs';
|
|
7
7
|
import { Range } from './Range.mjs';
|
|
8
8
|
import { Table, type TableRow, type TableCell } from './Table.mjs';
|
|
9
|
-
import { ContentControl, type ContentControlType } from './ContentControl.mjs';
|
|
9
|
+
import { ContentControl, type BlockRefusal, type ContentControlType, type ContentControlOptions } from './ContentControl.mjs';
|
|
10
10
|
import { InlinePicture, type InlinePictureOptions } from './InlinePicture.mjs';
|
|
11
11
|
import { type SearchOptions } from './search.mjs';
|
|
12
12
|
import type { Bound } from './binder.mjs';
|
|
@@ -18,6 +18,7 @@ export type SelectResult = Paragraph | Table | TableRow | TableCell | ContentCon
|
|
|
18
18
|
import type { Comment } from './Comment.mjs';
|
|
19
19
|
import { type ChangeTracker } from './tracking.mjs';
|
|
20
20
|
import { type TrackedChange } from './TrackedChange.mjs';
|
|
21
|
+
import { type TrackedChangeSelection } from './trackedChangeFilter.mjs';
|
|
21
22
|
import { type List, type ListLabel } from './List.mjs';
|
|
22
23
|
/** Where a paragraph or table is, for agents and across tool calls (CR-002 section 3.3). */
|
|
23
24
|
export type Address = string | {
|
|
@@ -34,7 +35,16 @@ export interface OutlineParagraph {
|
|
|
34
35
|
address: string;
|
|
35
36
|
paraId?: string;
|
|
36
37
|
style: string;
|
|
38
|
+
/** The text model's text of the paragraph (CR-012 D3): hidden text left out, a deleted mark joined, in the options' view. */
|
|
37
39
|
text: string;
|
|
40
|
+
/** True for a paragraph in a text box, listed after its anchor at a `textbox:` address (CR-012 D3, D4). */
|
|
41
|
+
textbox?: true;
|
|
42
|
+
/**
|
|
43
|
+
* The addresses of the paragraphs the view joins to this one, in order (a deleted mark in the `accepted`
|
|
44
|
+
* view, an inserted one in `original`): their text is in `text`, and they have no entry of their own
|
|
45
|
+
* (CR-012 section 17.13).
|
|
46
|
+
*/
|
|
47
|
+
joined?: string[];
|
|
38
48
|
}
|
|
39
49
|
export interface OutlineTable {
|
|
40
50
|
address: string;
|
|
@@ -45,6 +55,10 @@ export interface Outline {
|
|
|
45
55
|
paragraphs: OutlineParagraph[];
|
|
46
56
|
tables: OutlineTable[];
|
|
47
57
|
}
|
|
58
|
+
/** Which of a body's blocks `Body.outline` reads (CR-012 section 17.13): its top-level blocks, by index or view. */
|
|
59
|
+
export interface OutlineSelection {
|
|
60
|
+
blocks: readonly (number | Paragraph | BlockElement)[];
|
|
61
|
+
}
|
|
48
62
|
/**
|
|
49
63
|
* A subset of Office JS `Word.Body` over any container with block-level content: the main
|
|
50
64
|
* document's body, a header, a footer, a footnote, a cell or a content control. A view: the
|
|
@@ -77,10 +91,22 @@ export declare class Body {
|
|
|
77
91
|
* which does it) first - or read direct formatting with `{ direct: true }`.
|
|
78
92
|
*/
|
|
79
93
|
get propertyResolver(): PropertyResolver;
|
|
94
|
+
/** Which of a paragraph's runs are hidden: a run's own `w:vanish`, else its styles' (`hiddenRunsOf`; CR-012 phase 4). */
|
|
95
|
+
hiddenRuns(p: wml.P): HiddenRuns;
|
|
80
96
|
/** The live content array (docx4j getContent()); block-level elements only, sectPr excluded. */
|
|
81
97
|
get content(): Element[];
|
|
82
|
-
/**
|
|
98
|
+
/**
|
|
99
|
+
* Every paragraph in document order, descending into tables and content controls, and into the
|
|
100
|
+
* selected branch of a kept `mc:AlternateContent` at block, row and cell level, as Word reads it
|
|
101
|
+
* (CR-013 phase 2). A paragraph in a branch is read-only (D4).
|
|
102
|
+
*/
|
|
83
103
|
get paragraphs(): Paragraph[];
|
|
104
|
+
/**
|
|
105
|
+
* The paragraphs a walk in this mode takes: a reader's, `paragraphs`; a bulk edit's (`'every'`), every
|
|
106
|
+
* branch's too, the selected branch's where a reader sees them and each other branch's after them,
|
|
107
|
+
* where the element stands (CR-013 phase 3).
|
|
108
|
+
*/
|
|
109
|
+
private paragraphsIn;
|
|
84
110
|
/**
|
|
85
111
|
* The content-API views an XPath selects (CR-006): a `ContentControl`, `Table`, `TableRow`,
|
|
86
112
|
* `TableCell` or `Paragraph` where the selected element has one, at any depth - an inline content
|
|
@@ -109,10 +135,25 @@ export declare class Body {
|
|
|
109
135
|
* JS. A run in a text box is not one of the paragraph's, and stays a `Bound`.
|
|
110
136
|
*/
|
|
111
137
|
private viewsByObject;
|
|
112
|
-
/**
|
|
138
|
+
/**
|
|
139
|
+
* The tables directly in this body, as Office JS reports them (nested tables are a cell's), a table in
|
|
140
|
+
* the selected branch of a kept block-level `mc:AlternateContent` among them (CR-013 phase 2).
|
|
141
|
+
*/
|
|
113
142
|
get tables(): Table[];
|
|
114
143
|
/** Every content control in this body, in document order, nested ones included. */
|
|
115
144
|
get contentControls(): ContentControl[];
|
|
145
|
+
/**
|
|
146
|
+
* Office JS `getContentControls` (WordApi 1.5): the content controls `contentControls` lists, those of `options.types`
|
|
147
|
+
* where given. Word's `contentControls` lists rich-text controls only; this package's lists every kind, a recorded
|
|
148
|
+
* departure (CR-002 section 60 G1, check 55b), so this is how add-in code that asks for plain-text controls finds them.
|
|
149
|
+
*/
|
|
150
|
+
getContentControls(options?: ContentControlOptions): ContentControl[];
|
|
151
|
+
/**
|
|
152
|
+
* The content controls a walk in this mode takes: a reader's, `contentControls`; the binding passes'
|
|
153
|
+
* (`'every'`), every branch's of a kept `mc:AlternateContent` too, each other branch's where the element
|
|
154
|
+
* stands (CR-013 phase 3). An extension.
|
|
155
|
+
*/
|
|
156
|
+
contentControlsIn(mode: BranchMode): ContentControl[];
|
|
116
157
|
/** Every inline picture in this body, in document order (Office JS Body.inlinePictures). */
|
|
117
158
|
get inlinePictures(): InlinePicture[];
|
|
118
159
|
/**
|
|
@@ -139,15 +180,29 @@ export declare class Body {
|
|
|
139
180
|
}, prefix?: string): Body;
|
|
140
181
|
/** The view of a `w:p` somewhere in this body's tree; its container comes from PARENT. */
|
|
141
182
|
paragraphFor(p: wml.P): Paragraph | undefined;
|
|
142
|
-
/**
|
|
183
|
+
/**
|
|
184
|
+
* The text as Office JS's `body.text` gives it in Word's default view (CR-012 phase 4; checks 30, 31, 48
|
|
185
|
+
* and 51): each paragraph's text (`Paragraph.text`) followed by its mark, `\r`, the last paragraph's left
|
|
186
|
+
* out; in a table a row's cells a `\t` apart, each cell's paragraphs a mark apart (its last mark not
|
|
187
|
+
* written), and the row ended by `\r\n`. Text boxes are not the body's (check 42).
|
|
188
|
+
*/
|
|
143
189
|
get text(): string;
|
|
144
190
|
/**
|
|
145
191
|
* The text in one of the two views (extension; `text` is the accepted one).
|
|
146
192
|
* `{ view: 'original' }` reads the document as it was before the tracked changes.
|
|
147
193
|
*/
|
|
148
194
|
getText(options?: TextViewOptions): string;
|
|
195
|
+
/**
|
|
196
|
+
* The body's range (Office JS `Body.getRange`; CR-014 phase 1): 'Whole' from its first paragraph's start to
|
|
197
|
+
* its last one's end, with that paragraph's mark (check 51: a cell's `CELLP1\rCELLP2\rCELLP3\t`, a note's
|
|
198
|
+
* `… NOTEP2\r`), 'Content' the same without the mark, 'Start' and 'End' collapsed at its ends.
|
|
199
|
+
*/
|
|
200
|
+
getRange(location?: 'Whole' | 'Start' | 'End' | 'Content'): Range;
|
|
201
|
+
private textIn;
|
|
149
202
|
/** The package's change tracker while `changeTrackingMode` is on; undefined when it is off (CR-002 phase F). */
|
|
150
203
|
get changeTracker(): ChangeTracker | undefined;
|
|
204
|
+
/** Refuses a write to a body in a branch of a kept `mc:AlternateContent`: a cell or a control a reader found there (CR-013 D4). */
|
|
205
|
+
private assertWritable;
|
|
151
206
|
insertParagraph(text: string, location: 'Start' | 'End'): Paragraph;
|
|
152
207
|
/** Text at the start of the first paragraph, the end of the last, or replacing everything with one paragraph. */
|
|
153
208
|
insertText(text: string, location: 'Start' | 'End' | 'Replace'): Range;
|
|
@@ -168,7 +223,7 @@ export declare class Body {
|
|
|
168
223
|
* before or after a target paragraph, element or address. Links PARENT. Rejects anything the
|
|
169
224
|
* body cannot hold, naming what was passed. Returns the view of the first inserted element.
|
|
170
225
|
*/
|
|
171
|
-
insertElement(element: Element | Element[], location: 'Start' | 'End' | 'Before' | 'After', target?: Paragraph | BlockElement | Address): Paragraph | BlockElement;
|
|
226
|
+
insertElement(element: Element | Element[], location: 'Start' | 'End' | 'Before' | 'After', target?: Paragraph | BlockElement | Address, refusal?: BlockRefusal, replacing?: Element): Paragraph | BlockElement;
|
|
172
227
|
/** Inserts a WML fragment (one or more w:p / w:tbl / ... as inside document.xml); the standard prefixes are declared for it. */
|
|
173
228
|
insertXml(xml: string, location: 'Start' | 'End' | 'Before' | 'After', target?: Paragraph | BlockElement | Address): Promise<(Paragraph | BlockElement)[]>;
|
|
174
229
|
/**
|
|
@@ -179,6 +234,13 @@ export declare class Body {
|
|
|
179
234
|
* what was inserted, as `insertXml` does, since a package may bring several blocks.
|
|
180
235
|
*/
|
|
181
236
|
insertOoxml(ooxml: string, location: 'Start' | 'End' | 'Replace' | 'Before' | 'After', target?: Paragraph | BlockElement | Address): Promise<(Paragraph | BlockElement)[]>;
|
|
237
|
+
/**
|
|
238
|
+
* After an insertion into a cell: the cell still ends with a paragraph, as Word reads it (CR-002 section 55). Where
|
|
239
|
+
* a table went in after the paragraph the cell ended with, in the cell's own content, Word's form (check 52, cases 86
|
|
240
|
+
* and 87, `keepCellMarkLast`): that paragraph split at its end, the cell's mark staying last after the table, the
|
|
241
|
+
* first half's mark the inserted one under tracking. Anywhere else docx4j's repair, an empty paragraph after any wrapper.
|
|
242
|
+
*/
|
|
243
|
+
private keepCellEnd;
|
|
182
244
|
/** The package's DOM preprocessor (the MCE one), for fragments and incoming packages. */
|
|
183
245
|
private preprocessor;
|
|
184
246
|
private insertContent;
|
|
@@ -194,40 +256,89 @@ export declare class Body {
|
|
|
194
256
|
* Removes everything (section properties stay). While the package tracks changes, every
|
|
195
257
|
* paragraph is marked deleted and every row's `w:trPr` takes a `w:del` instead. Removed outright,
|
|
196
258
|
* the relationships the content held (its pictures' images) are settled on save (CR-002 section 47).
|
|
259
|
+
* In a table cell the paragraph the cell ends with stays, emptied, its properties kept, and tracked
|
|
260
|
+
* only its text is deleted, as Word keeps a cell's last paragraph (check 52, cases 92 and 93; CR-002 section 55.6).
|
|
197
261
|
*/
|
|
198
262
|
clear(): void;
|
|
263
|
+
/**
|
|
264
|
+
* `clear()`; with `keepCellEnd` false a cell's last paragraph goes as well, its mark marked deleted under
|
|
265
|
+
* tracking, for a caller that puts its own paragraph in next (`insertText(…, 'Replace')`, `TableCell.value`).
|
|
266
|
+
* @internal
|
|
267
|
+
*/
|
|
268
|
+
clearContent(keepCellEnd: boolean): void;
|
|
269
|
+
/**
|
|
270
|
+
* Marks everything in this body deleted in place, in every branch of a kept `mc:AlternateContent`: each
|
|
271
|
+
* paragraph's text and mark, each row of its tables (a tracked row or table deletion's cells; CR-013
|
|
272
|
+
* phase 3). Internal: what `Table.delete` and `deleteRows` write while changes are tracked.
|
|
273
|
+
*/
|
|
274
|
+
markContentDeleted(tracker: ChangeTracker): void;
|
|
199
275
|
/**
|
|
200
276
|
* Every tracked change in this body, in document order. Touching insertions or deletions by one
|
|
201
277
|
* author - a deleted paragraph's text and mark, a deletion across a mark - are one change, as
|
|
202
278
|
* Office JS lists them (CR-002 section 29, checks 22 and 23).
|
|
279
|
+
*
|
|
280
|
+
* In a kept `mc:AlternateContent` at block, paragraph, row or cell level the selected branch's changes
|
|
281
|
+
* are listed, as Word reads it (CR-013 phase 2); each other branch's are their twins, paired by kind and
|
|
282
|
+
* position, which resolving a listed change resolves too (phase 3, docx4j's twins).
|
|
203
283
|
*/
|
|
204
284
|
getTrackedChanges(): TrackedChange[];
|
|
285
|
+
/** The listing in either mode (`Listing`): resolve-all's puts every other branch's changes after the story's. */
|
|
286
|
+
private trackedChanges;
|
|
205
287
|
/**
|
|
206
288
|
* Accepts every tracked change, last first so that a paragraph join never disturbs one still
|
|
207
289
|
* to do (docx4j `AcceptTrackedChanges` is the reference). Returns how many were listed.
|
|
290
|
+
*
|
|
291
|
+
* With a filter (an extension, CR-011), only the single changes it matches are accepted, so a group
|
|
292
|
+
* can be resolved in part, and what no change owns is left alone; the count is of the listed changes
|
|
293
|
+
* with a matching piece (docx4j's `TrackedChanges.acceptAll(pkg, filter)`).
|
|
208
294
|
*/
|
|
209
|
-
acceptAll(): number;
|
|
210
|
-
/** Rejects every tracked change, last first. Returns how many were listed. */
|
|
211
|
-
rejectAll(): number;
|
|
295
|
+
acceptAll(filter?: TrackedChangeSelection): number;
|
|
296
|
+
/** Rejects every tracked change, last first, as `acceptAll` accepts them. Returns how many were listed. */
|
|
297
|
+
rejectAll(filter?: TrackedChangeSelection): number;
|
|
212
298
|
/**
|
|
213
299
|
* Resolving one change can leave another to be listed afresh: accepting a move carries a deletion
|
|
214
300
|
* nested in its moved text out of it, and resolving a broken move dissolves the rest of it into a
|
|
215
301
|
* new `w:ins` or `w:del` (CR-002 section 29), so the list read first goes stale. The list is read
|
|
216
|
-
* again after each pass until nothing is left, as "all" promises (found by the editor's C5);
|
|
217
|
-
*
|
|
302
|
+
* again after each pass until nothing is left, as "all" promises (found by the editor's C5); as
|
|
303
|
+
* docx4j's `TrackedChanges.resolveAll` does it (CR-011): a change whose pieces all match is resolved
|
|
304
|
+
* whole, one with some matching its matching pieces alone, for up to 20 passes, and two passes in a
|
|
305
|
+
* row that leave as many matching changes as the one before end it. Then, with no filter, what is
|
|
306
|
+
* never listed is swept.
|
|
218
307
|
*/
|
|
219
308
|
private resolveAll;
|
|
220
|
-
/** Every `w:tr` in this body's tables, in document order (rows of nested tables included). */
|
|
309
|
+
/** Every `w:tr` in this body's tables, in document order (rows of nested tables included), in every branch (CR-013 phase 3). */
|
|
221
310
|
private rowElements;
|
|
222
311
|
/** The part's XML (extension; Office JS getOoxml wraps it in a package). */
|
|
223
312
|
getXml(): Promise<string>;
|
|
224
|
-
/**
|
|
313
|
+
/**
|
|
314
|
+
* The element at an address: 'body/3' (fourth block), 'body/3/1/0/2' (table row 1, cell 0, block 2),
|
|
315
|
+
* 'body/3/textbox:0/1' (the second block of the first text box body/3 anchors, CR-012 D4), a paraId, or a
|
|
316
|
+
* text match. Undefined, never an error, where the address names nothing.
|
|
317
|
+
*/
|
|
225
318
|
elementAt(address: Address): BlockElement | undefined;
|
|
226
319
|
paragraphAt(address: Address): Paragraph | undefined;
|
|
227
320
|
/** The ordinal address of a paragraph or element in this body, from PARENT links; undefined when it is not here. */
|
|
228
321
|
addressOf(target: Paragraph | BlockElement): string | undefined;
|
|
229
|
-
/**
|
|
230
|
-
|
|
322
|
+
/**
|
|
323
|
+
* What an agent asks for first: every paragraph and table with its address, style and text, read by the
|
|
324
|
+
* text model (CR-012 D3; `Texts.of`'s options, `TextOptionsInit`): each paragraph's text is the model's
|
|
325
|
+
* (hidden text left out, a paragraph whose mark the view deletes joined to the next, in the view asked
|
|
326
|
+
* for), and each text box's paragraphs follow their anchoring paragraph, or the table it is in (REQ-518),
|
|
327
|
+
* at `textbox:` addresses (`body/3/textbox:0/1`), flagged `textbox`. A cell's paragraphs and tables follow
|
|
328
|
+
* their table's entry.
|
|
329
|
+
* Async since phase 4, as the model's reading is; calls under one `TextContext` (`Texts.contextOf`) read
|
|
330
|
+
* the package's stories once. The package is not changed (REQ-204).
|
|
331
|
+
*
|
|
332
|
+
* With `select`, only some of this body's top-level blocks are read (CR-012 section 17.13): their entries
|
|
333
|
+
* are those the whole outline gives them under the same context and options, in document order. A
|
|
334
|
+
* paragraph whose text a paragraph before it holds (`joined`) gives none; a block that starts inside a
|
|
335
|
+
* field open before it (a table of contents left out, D12) is read inside it. Under a context, the first
|
|
336
|
+
* such call over a body walks its blocks' field characters once; each block after that costs its own
|
|
337
|
+
* reading. A context is a snapshot: after an edit, make another.
|
|
338
|
+
*/
|
|
339
|
+
outline(options?: object, context?: object, select?: OutlineSelection): Promise<Outline>;
|
|
340
|
+
/** The index in `content` of one of this body's top-level blocks. */
|
|
341
|
+
private blockIndexOf;
|
|
231
342
|
/** docx4j MainDocumentPart.addParagraphOfText. */
|
|
232
343
|
addParagraphOfText(text: string): wml.P;
|
|
233
344
|
/** docx4j MainDocumentPart.addStyledParagraphOfText. */
|
|
@@ -241,9 +352,11 @@ export declare class Body {
|
|
|
241
352
|
private ownerOf;
|
|
242
353
|
private containerOf;
|
|
243
354
|
private pathOf;
|
|
244
|
-
/**
|
|
245
|
-
|
|
246
|
-
|
|
355
|
+
/**
|
|
356
|
+
* Gives a new paragraph a w14:paraId when the document already uses them, free in every branch (CR-013 phase 3).
|
|
357
|
+
* @internal a paragraph split (CR-014 phase 2) gives its new first half one.
|
|
358
|
+
*/
|
|
359
|
+
assignParaId(p: wml.P): void;
|
|
247
360
|
/**
|
|
248
361
|
* The comments anchored in this body, in document order, with replies nested under their
|
|
249
362
|
* parent (only top-level comments are in the array). Asynchronous because it unmarshals the
|
|
@@ -258,13 +371,22 @@ export declare class Body {
|
|
|
258
371
|
insertContentControl(kind?: ContentControlType): ContentControl;
|
|
259
372
|
}
|
|
260
373
|
/**
|
|
261
|
-
* A story's tracked changes resolved (`Body.acceptAll` or `rejectAll
|
|
262
|
-
* it - a `w:txbxContent`, in a DrawingML shape or a VML one - which Word
|
|
263
|
-
* (CR-002 section 49). A text box inside a text box is reached through its
|
|
264
|
-
* changes were listed.
|
|
374
|
+
* A story's tracked changes resolved (`Body.acceptAll` or `rejectAll`, with the filter if one is given),
|
|
375
|
+
* then those of each text box in it - a `w:txbxContent`, in a DrawingML shape or a VML one - which Word
|
|
376
|
+
* counts as a story of its own (CR-002 section 49). A text box inside a text box is reached through its
|
|
377
|
+
* own story. Returns how many changes were listed (with a filter, how many had a matching piece).
|
|
265
378
|
*
|
|
266
379
|
* In a kept `mc:AlternateContent` the text box of every branch is resolved, so that each says the same
|
|
267
380
|
* afterwards (docx4j's `McMode.ALL`), and the changes are counted in the selected branch alone, so a
|
|
268
381
|
* text box held in both counts once, as a resolved load's does (CR-010 phase 3).
|
|
269
382
|
*/
|
|
270
|
-
export declare function resolveStory(body: Body, what: 'accept' | 'reject'): number;
|
|
383
|
+
export declare function resolveStory(body: Body, what: 'accept' | 'reject', filter?: TrackedChangeSelection): number;
|
|
384
|
+
/**
|
|
385
|
+
* A story's tracked changes (`Body.getTrackedChanges`), then each text box's in it, as `resolveStory`
|
|
386
|
+
* resolves them: docx4j's order (its CR-043 `Lister`, CR-011). In a kept `mc:AlternateContent` the
|
|
387
|
+
* selected branch's text boxes alone are listed, so a text box held in both branches is listed once;
|
|
388
|
+
* each other branch's box at the same place is its twin, whose changes are paired with the listed ones
|
|
389
|
+
* by kind and position and resolved with them, as docx4j resolves a text box's `mc:Fallback` twin
|
|
390
|
+
* (`pairTwins`; CR-013 phase 3).
|
|
391
|
+
*/
|
|
392
|
+
export declare function trackedChangesOfStory(body: Body): TrackedChange[];
|