@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,21 @@
|
|
|
1
1
|
import type * as wml from '@docx4j/generated-objects-ts/modules/org_docx4j_wml';
|
|
2
|
+
import type * as math from '@docx4j/generated-objects-ts/modules/org_docx4j_math';
|
|
3
|
+
import type * as mce from '@docx4j/generated-objects-ts/modules/org_docx4j_mce';
|
|
2
4
|
import { type Element, type Located, type RevisionKind } from './tree.mjs';
|
|
3
5
|
import { Range } from './Range.mjs';
|
|
4
6
|
import type { Paragraph } from './Paragraph.mjs';
|
|
7
|
+
import type { Body } from './Body.mjs';
|
|
8
|
+
import type { Part } from '../../parts/Part.mjs';
|
|
9
|
+
import type { XmlPart } from '../../parts/XmlPart.mjs';
|
|
10
|
+
import { type RelationshipRemovals } from './relationships.mjs';
|
|
5
11
|
/** Office JS `Word.ChangeTrackingState` (`Unknown` is not produced here). */
|
|
6
12
|
export type TrackedChangeType = 'Added' | 'Deleted' | 'Formatted' | 'None' | 'Unknown';
|
|
13
|
+
/**
|
|
14
|
+
* docx4j's finer kind of change (its `TrackedChange.Kind`, CR-043), the names verbatim, as data values
|
|
15
|
+
* a filter written for docx4j or passed as JSON carries over in (CR-011 D3). `INSERTION`, `DELETION` and
|
|
16
|
+
* `FORMATTING` are a group's whose pieces are of more than one kind.
|
|
17
|
+
*/
|
|
18
|
+
export type TrackedChangeKind = 'RUN_INSERTION' | 'RUN_DELETION' | 'MOVE' | 'PARAGRAPH_MARK_INSERTION' | 'PARAGRAPH_MARK_DELETION' | 'RUN_PROPERTIES' | 'PARAGRAPH_MARK_PROPERTIES' | 'PARAGRAPH_PROPERTIES' | 'ROW_INSERTION' | 'ROW_DELETION' | 'FIELD_INSERTION' | 'CONTENT_CONTROL_INSERTION' | 'CONTENT_CONTROL_DELETION' | 'MATH_STRUCTURE_INSERTION' | 'MATH_STRUCTURE_DELETION' | 'INSERTION' | 'DELETION' | 'FORMATTING' | 'TABLE_PROPERTIES' | 'SECTION_PROPERTIES' | 'CELL_INSERTION' | 'CELL_DELETION';
|
|
7
19
|
/** Which piece of revision markup a `TrackedChange` is over (an extension: Office JS has no such member). */
|
|
8
20
|
export type TrackedChangeTarget =
|
|
9
21
|
/** `w:ins` / `w:del` / `w:moveFrom` / `w:moveTo` around runs. */
|
|
@@ -103,28 +115,81 @@ export type TrackedChangeTarget =
|
|
|
103
115
|
* `w:sdt` or `w:customXml`, `owner` the list holding it, `outer` the pair in that list and `inner`
|
|
104
116
|
* the pair in its content. Rejecting takes the element away and leaves its content where it
|
|
105
117
|
* stood; accepting takes the markers away. Its text is its content's, which the pieces inside
|
|
106
|
-
* report.
|
|
118
|
+
* report. Or a deletion, `revision` `del`: the same form with `w:customXmlDelRangeStart` and `End`,
|
|
119
|
+
* Word's for a control a tracked deletion took (check 54 cases 15 and 17; CR-014 section 12), which
|
|
120
|
+
* groups with the deletions around and inside it; accepting takes the element away, rejecting the markers.
|
|
107
121
|
*/
|
|
108
122
|
| {
|
|
109
123
|
kind: 'holder';
|
|
124
|
+
revision: 'ins' | 'del';
|
|
110
125
|
holder: Element;
|
|
111
126
|
owner: Element[];
|
|
112
127
|
outer: [Element, Element];
|
|
113
128
|
inner: [Element, Element];
|
|
114
129
|
value: wml.CTTrackChange;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* A field Word inserted under tracking, in its own form: a `w:ins` around the field's begin and
|
|
133
|
+
* instruction runs and another around its end, the separator and the result between them plain
|
|
134
|
+
* (check 30, `field-inserted`). Office JS lists it as one `Added` change whose text is the result's,
|
|
135
|
+
* and Word's Reject All took the whole field away, the result with it (CR-002 section 44). `span` is
|
|
136
|
+
* the items of `owner` from the first `w:ins` to the last.
|
|
137
|
+
*/
|
|
138
|
+
| {
|
|
139
|
+
kind: 'field';
|
|
140
|
+
span: Element[];
|
|
141
|
+
owner: Element[];
|
|
142
|
+
value: wml.CTTrackChange;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* A `w:ins` or `w:del` inside an `m:r`, which is where Word writes an equation's text inserted or
|
|
146
|
+
* deleted (`m:r` > `w:ins` > `m:rPr`, `w:rPr`, `m:t`; docx4j's `tracked-changes-equations.docx`).
|
|
147
|
+
* `item` is the `w:ins` or `w:del` in the run's content, `run` the `m:r` and `runOwner` its list.
|
|
148
|
+
* Kept, its content takes its place in the run; not kept, it goes, and a run left with no text with it
|
|
149
|
+
* (CR-002 section 51). `equation` is the `m:oMath` or `m:oMathPara` in the paragraph that holds it.
|
|
150
|
+
*/
|
|
151
|
+
| {
|
|
152
|
+
kind: 'mathRun';
|
|
153
|
+
revision: 'ins' | 'del';
|
|
154
|
+
item: Element;
|
|
155
|
+
run: Element<math.CTR>;
|
|
156
|
+
runOwner: Element[];
|
|
157
|
+
value: wml.CTMathRunTrackChange;
|
|
158
|
+
equation?: Element;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* A `w:ins` or `w:del` in an equation structure's `m:ctrlPr`, Word's mark of an `m:sSup`, an `m:acc`,
|
|
162
|
+
* ... inserted or deleted as a whole. `structure` is that element and `owner` its list, two up from
|
|
163
|
+
* the `m:ctrlPr`; undefined for an argument's own `m:ctrlPr` (an `m:e`'s), which marks no structure.
|
|
164
|
+
* Kept, the marker goes and the run properties it recorded become the control's; not kept, the
|
|
165
|
+
* structure goes whole, as Word's Accept All and Reject All did (CR-002 section 51).
|
|
166
|
+
*/
|
|
167
|
+
| {
|
|
168
|
+
kind: 'mathStructure';
|
|
169
|
+
revision: 'ins' | 'del';
|
|
170
|
+
ctrlPr: math.CTCtrlPr;
|
|
171
|
+
structure?: Element;
|
|
172
|
+
owner?: Element[];
|
|
173
|
+
value: wml.CTRPrChange;
|
|
174
|
+
equation?: Element;
|
|
115
175
|
};
|
|
116
176
|
/**
|
|
117
177
|
* A subset of Office JS `Word.TrackedChange`: `type`, `author`, `date`, `text`, `accept()`,
|
|
118
|
-
* `reject()` and `getRange()`, plus `element`, `id
|
|
119
|
-
* `Paragraph` and `Range`: it holds the markup it is
|
|
178
|
+
* `reject()` and `getRange()`, plus `element`, `id`, `target`, and docx4j's `kind`, `part` and
|
|
179
|
+
* `pieces` (CR-011) as extensions. A view, like `Paragraph` and `Range`: it holds the markup it is
|
|
180
|
+
* over, nothing is cached.
|
|
120
181
|
*/
|
|
121
182
|
export declare class TrackedChange {
|
|
122
183
|
readonly target: TrackedChangeTarget;
|
|
123
184
|
/** The paragraph the change is in; undefined for a row revision. */
|
|
124
185
|
readonly paragraph: Paragraph | undefined;
|
|
186
|
+
/** The body a change without a paragraph (a row, a cell) is in, for the notes it may take away. */
|
|
187
|
+
readonly body?: Body | undefined;
|
|
125
188
|
constructor(target: TrackedChangeTarget,
|
|
126
189
|
/** The paragraph the change is in; undefined for a row revision. */
|
|
127
|
-
paragraph: Paragraph | undefined
|
|
190
|
+
paragraph: Paragraph | undefined,
|
|
191
|
+
/** The body a change without a paragraph (a row, a cell) is in, for the notes it may take away. */
|
|
192
|
+
body?: Body | undefined);
|
|
128
193
|
/** Office JS `Word.ChangeTrackingState`. */
|
|
129
194
|
get type(): TrackedChangeType;
|
|
130
195
|
get author(): string;
|
|
@@ -136,6 +201,24 @@ export declare class TrackedChange {
|
|
|
136
201
|
get date(): Date | undefined;
|
|
137
202
|
/** The annotation id (`w:id`; an extension). */
|
|
138
203
|
get id(): number;
|
|
204
|
+
/**
|
|
205
|
+
* docx4j's kind of change (an extension; its `TrackedChange.getKind()`, CR-011): `target.kind` in
|
|
206
|
+
* docx4j's names, an equation's runs as runs. A group's is its pieces' when they are all of one kind,
|
|
207
|
+
* else `INSERTION`, `DELETION` or `FORMATTING`.
|
|
208
|
+
*/
|
|
209
|
+
get kind(): TrackedChangeKind;
|
|
210
|
+
/**
|
|
211
|
+
* The part the change's story is in (an extension; docx4j's `getPart()`, CR-011): the main document
|
|
212
|
+
* part, a header or footer part, the footnotes, endnotes or comments part. A text box's change gives
|
|
213
|
+
* the part the text box is in.
|
|
214
|
+
*/
|
|
215
|
+
get part(): XmlPart<unknown> | undefined;
|
|
216
|
+
/**
|
|
217
|
+
* The single changes this one groups, in document order (an extension; docx4j's `getPieces()`,
|
|
218
|
+
* CR-011); a change that is no group is its own one piece. A filter's conditions are met or not by
|
|
219
|
+
* each piece, and each can be accepted or rejected on its own.
|
|
220
|
+
*/
|
|
221
|
+
get pieces(): readonly TrackedChange[];
|
|
139
222
|
/** The markup this change is over (an extension): the `w:ins` element, the `w:rPrChange`, ... */
|
|
140
223
|
get element(): object;
|
|
141
224
|
/** The text the change covers; `\r` for a paragraph mark, as Office JS gives it (check 22). */
|
|
@@ -145,22 +228,139 @@ export declare class TrackedChange {
|
|
|
145
228
|
/**
|
|
146
229
|
* Keeps the change: a `w:ins` is unwrapped, a `w:del` removed, a deleted mark joins the paragraphs.
|
|
147
230
|
* Either half of a move keeps the whole move, as Word's Review tab does (CR-002 section 29).
|
|
231
|
+
*
|
|
232
|
+
* Returns whether it acted: false, changing nothing, when the change has been resolved since it was
|
|
233
|
+
* listed (CR-002 section 53). An extension: Office JS's `accept()` returns nothing.
|
|
234
|
+
*/
|
|
235
|
+
accept(): boolean;
|
|
236
|
+
/**
|
|
237
|
+
* The change's twins resolved the same way: the changes in the other branches of the kept
|
|
238
|
+
* `mc:AlternateContent` this one was listed from, paired with it by kind and position (`pairTwins`,
|
|
239
|
+
* docx4j's; CR-013 phase 3), each with its own twins. A group's twins are its pieces', which its
|
|
240
|
+
* pieces resolve. A twin resolved since it was listed is passed over.
|
|
148
241
|
*/
|
|
149
|
-
|
|
242
|
+
private resolveTwins;
|
|
243
|
+
private acceptHere;
|
|
150
244
|
/**
|
|
151
245
|
* Puts back what was there: a `w:ins` is removed, a `w:del` restored, a `w:rPrChange` re-applied.
|
|
152
246
|
* Either half of a move rejects the whole move, as Word's Review tab does (CR-002 section 29).
|
|
247
|
+
*
|
|
248
|
+
* Returns whether it acted, as `accept()` does.
|
|
153
249
|
*/
|
|
154
|
-
reject():
|
|
250
|
+
reject(): boolean;
|
|
251
|
+
/**
|
|
252
|
+
* Whether the record this view was listed for, `target.value`, is still where it was listed. A view
|
|
253
|
+
* whose change has been resolved since, by itself or by another verb, does nothing; otherwise it
|
|
254
|
+
* would act on what stands there now (CR-002 section 53). The record is compared by identity. docx4j's
|
|
255
|
+
* views throw instead, once any change on the package has been resolved since they were listed; that
|
|
256
|
+
* would stop a loop resolving one listing last first, as `Body.acceptAll` does.
|
|
257
|
+
*/
|
|
258
|
+
private isCurrent;
|
|
259
|
+
private rejectHere;
|
|
260
|
+
/** The body the change is in. */
|
|
261
|
+
private get body_();
|
|
262
|
+
/** The package the change is in, which keeps the notes whose references it took away. */
|
|
263
|
+
private get package_();
|
|
155
264
|
private requireParagraph;
|
|
156
265
|
}
|
|
266
|
+
/**
|
|
267
|
+
* A group's pieces resolved: its runs last first, then its marks last first, so that a paragraph join
|
|
268
|
+
* never strands a piece still to do. Office JS and Word's Review tab resolve the group as one (checks
|
|
269
|
+
* 22 and 23), and so, piece by piece, does this.
|
|
270
|
+
*/
|
|
271
|
+
export declare function resolvePieces(pieces: readonly TrackedChange[], what: 'accept' | 'reject'): void;
|
|
272
|
+
/** The ids of the footnotes and endnotes whose references removed content took with it. */
|
|
273
|
+
export interface NoteRemovals {
|
|
274
|
+
footnote: Set<number>;
|
|
275
|
+
endnote: Set<number>;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Runs `resolve`, then takes away what went with the content it removed:
|
|
279
|
+
* - **Notes**: Word took a footnote from the notes part when its reference went with the content
|
|
280
|
+
* around it, accepting a deletion and rejecting an insertion alike (the editor's `review-for-word`
|
|
281
|
+
* saves, Word 15 and Word 2010); the entries go when the package is saved
|
|
282
|
+
* (`WordprocessingMLPackage.pendingNoteRemovals`).
|
|
283
|
+
* - **Bookmarks**: Word removed a bookmark whole when its end went with a deletion it accepted, and
|
|
284
|
+
* when the insertion it was put around went with a reject (docx4j CR-043's probe, C11 and C11b, Word
|
|
285
|
+
* 16.0.20326). docx4j's rule from the two (its CR-043 section 3.2) is followed here: a bookmark with a
|
|
286
|
+
* marker in removed content goes whole, its other marker too, even with content left beside it; so
|
|
287
|
+
* does one with content between its markers that is left with none, a deletion it was around accepted
|
|
288
|
+
* among them (U15); and one that was empty before, as `_GoBack` is, stays. Those three are not measured.
|
|
289
|
+
* - **Relationships and parts**: Word's saves kept no part the resolved content alone referenced. A
|
|
290
|
+
* picture deleted and accepted, or inserted and rejected, took its image part (docx4j CR-043's probe,
|
|
291
|
+
* C05 and C04), and a section break deleted and accepted took the headers and footers of the section
|
|
292
|
+
* it ended (C06: six of each became three). docx4j's rule (its CR-043 section 3.2, D7) is followed: a
|
|
293
|
+
* relationship of the change's part that the removed content referenced, through any `r:` attribute,
|
|
294
|
+
* goes when nothing left in the part references it; its part goes when no relationship in the package
|
|
295
|
+
* targets it any more, and what that part alone related to goes with it. The kinds beyond pictures,
|
|
296
|
+
* headers and footers (charts, OLE objects, `v:imagedata`) are docx4j's reading, not measured.
|
|
297
|
+
* - **Comments**: a comment `removeRevision` left with its range's start and end in different paragraphs
|
|
298
|
+
* goes whole when the joins have brought them into one list with nothing with text between
|
|
299
|
+
* (`settleSpanningComments`; CR-002 section 54).
|
|
300
|
+
* A change resolved inside another's (a row's cells, a group's pieces, `acceptAll`'s changes) shares the
|
|
301
|
+
* outer resolution, so the bookmarks are read twice for the lot, and not at all when nothing is removed.
|
|
302
|
+
*/
|
|
303
|
+
export declare function resolving(pkg: unknown, body: Body | undefined, resolve: () => void): void;
|
|
304
|
+
/**
|
|
305
|
+
* Queues the notes whose references `removed` holds to go when the package is saved, as a resolution's
|
|
306
|
+
* removals go: what a range deleted untracked takes with it (CR-014 phase 2; check 52 case 12, where Word took
|
|
307
|
+
* the footnote out of `footnotes.xml` with its reference). A note goes only where no reference to it stands
|
|
308
|
+
* by then (`flushPendingNoteRemovals`), so content queued and then kept costs nothing.
|
|
309
|
+
*/
|
|
310
|
+
export declare function queueNoteRemovals(pkg: unknown, removed: unknown): void;
|
|
311
|
+
/**
|
|
312
|
+
* The notes `pending` holds that `flushPendingNoteRemovals` will take away: those whose reference no
|
|
313
|
+
* longer stands in the main document's tree. A listing of every story leaves them out, as docx4j's,
|
|
314
|
+
* which removes them when its resolution ends, does (CR-011).
|
|
315
|
+
*/
|
|
316
|
+
export declare function notesGoing(mainTree: unknown, pending: NoteRemovals): NoteRemovals;
|
|
317
|
+
/** What `flushPendingNoteRemovals` needs of the main document part. */
|
|
318
|
+
interface NotesHost {
|
|
319
|
+
getContents(): Promise<unknown>;
|
|
320
|
+
footnotesPart?: Part & {
|
|
321
|
+
getContents(): Promise<wml.CTFootnotes>;
|
|
322
|
+
};
|
|
323
|
+
endnotesPart?: Part & {
|
|
324
|
+
getContents(): Promise<wml.CTEndnotes>;
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
/** Where a removed note's own content goes on to: the package's queues (`WordprocessingMLPackage`). */
|
|
328
|
+
interface NoteRemovalHost {
|
|
329
|
+
pendingCommentRemovals?: Set<number>;
|
|
330
|
+
pendingRelationshipRemovals?: RelationshipRemovals;
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* The notes `pending` holds taken out of the notes parts, each unless a reference to it still stands in
|
|
334
|
+
* the main document (an accepted move keeps the reference its source had, say); then `pending` is
|
|
335
|
+
* empty. A note's entry goes, Word's separators never: their ids are never referenced. The notes parts
|
|
336
|
+
* are read only when something is pending, so a save with none leaves them untouched. Word's own save
|
|
337
|
+
* also renumbers the notes left (the editor's `review-for-word` saves); their ids stay here.
|
|
338
|
+
*
|
|
339
|
+
* What a removed note held goes on with it, as docx4j's `Removals.flush` takes it (CR-002 section 50,
|
|
340
|
+
* docx4j's reading, not measured): the relationships its content referenced (a picture's image) are
|
|
341
|
+
* queued on `host` for the notes part, to go when nothing else uses them, and a comment whose reference
|
|
342
|
+
* was in it is queued for removal, its anchor being gone.
|
|
343
|
+
*/
|
|
344
|
+
export declare function flushPendingNoteRemovals(main: NotesHost, pending: NoteRemovals, host?: NoteRemovalHost): Promise<void>;
|
|
345
|
+
/** Adds the ids of the `w:commentReference` elements anywhere in a tree to `into`. */
|
|
346
|
+
export declare function commentReferencesIn(tree: unknown, into: Set<number>): void;
|
|
157
347
|
/**
|
|
158
348
|
* The insertion of a content control or custom XML element, when `items[i]` is a
|
|
159
349
|
* `w:customXmlInsRangeStart` and what follows is Word's form for one (check 30): the element, whose
|
|
160
350
|
* content starts with that marker's `w:customXmlInsRangeEnd` and ends with a second start, and that
|
|
161
|
-
* one's end right after the element
|
|
351
|
+
* one's end right after the element; or its deletion, the same form of `w:customXmlDelRangeStart` and
|
|
352
|
+
* `End` (check 54). Anything else is not one (a marker on its own is left alone).
|
|
162
353
|
*/
|
|
163
|
-
export declare function
|
|
354
|
+
export declare function holderChangeAt(items: Element[], i: number, paragraph: Paragraph | undefined, body?: Body): TrackedChange | undefined;
|
|
355
|
+
/**
|
|
356
|
+
* Word's form for a field inserted under tracking, when `items[i]` starts it: a `w:ins` that opens a
|
|
357
|
+
* field (a `w:fldChar` begin it does not end), then plain runs - the separator and the result - and
|
|
358
|
+
* markers, then a `w:ins` by the same author in which that field ends (check 30, `field-inserted`:
|
|
359
|
+
* begin and instruction in one, the end run in the other). Another revision, a run whose formatting
|
|
360
|
+
* changed, a run holder, or a field that ends in a plain run is not this form, and is listed as before.
|
|
361
|
+
* A field wholly inside one `w:ins` needs nothing of this: that `w:ins` already takes it whole.
|
|
362
|
+
*/
|
|
363
|
+
export declare function insertedFieldAt(items: Element[], i: number, paragraph: Paragraph | undefined): TrackedChange | undefined;
|
|
164
364
|
/**
|
|
165
365
|
* docx4j AcceptTrackedChanges: the paragraph takes the next one's content and properties, so the
|
|
166
366
|
* mark that survives is the next one's. Called when a deleted mark is accepted and when an
|
|
@@ -168,10 +368,64 @@ export declare function holderInsertionAt(items: Element[], i: number, paragraph
|
|
|
168
368
|
*
|
|
169
369
|
* `fallbackToPrevious` is for the second case at the end of a container, where this package's
|
|
170
370
|
* inserted paragraph carries its own mark (section 13) and there is nothing after it to join
|
|
171
|
-
* with: the paragraph then goes, its content joining the one before.
|
|
172
|
-
*
|
|
371
|
+
* with: the paragraph then goes, its content joining the one before. Otherwise, with no paragraph
|
|
372
|
+
* next, a join never crosses a container's edge, and Word 365's Accept All (check 54 and the text-left
|
|
373
|
+
* probe, docx4j CR-043 section 17) does one of four things: an emptied paragraph with a table or a
|
|
374
|
+
* block control next goes; text left with a table next joins the table's first cell's first paragraph,
|
|
375
|
+
* which keeps its properties; with a block control next it takes the control's first paragraph's
|
|
376
|
+
* properties, nothing joined; a control's last paragraph keeps a bare mark. Else the mark is only dropped.
|
|
173
377
|
*/
|
|
174
378
|
export declare function joinWithNext(paragraph: Pick<Paragraph, 'container' | 'element' | 'p'>, fallbackToPrevious?: boolean): void;
|
|
379
|
+
/** The first paragraph of a table's first cell, where a paragraph joining into the table lands; docx4j's `firstCellParagraph`. */
|
|
380
|
+
export declare function firstCellParagraphOf(tbl: wml.Tbl): wml.P | undefined;
|
|
381
|
+
/**
|
|
382
|
+
* One piece of a move's markup, in document order: a range marker, a run-level half (`w:moveFrom`
|
|
383
|
+
* or `w:moveTo` around runs), or a moved paragraph's mark (`w:pPr/w:rPr/w:moveFrom` or `w:moveTo`).
|
|
384
|
+
*/
|
|
385
|
+
export type MovePiece = {
|
|
386
|
+
kind: 'start';
|
|
387
|
+
side: 'from' | 'to';
|
|
388
|
+
id: number;
|
|
389
|
+
name: string;
|
|
390
|
+
element: Element;
|
|
391
|
+
owner: Element[];
|
|
392
|
+
} | {
|
|
393
|
+
kind: 'end';
|
|
394
|
+
side: 'from' | 'to';
|
|
395
|
+
id: number;
|
|
396
|
+
element: Element;
|
|
397
|
+
owner: Element[];
|
|
398
|
+
} | {
|
|
399
|
+
kind: 'half';
|
|
400
|
+
side: 'from' | 'to';
|
|
401
|
+
element: Element;
|
|
402
|
+
owner: Element[];
|
|
403
|
+
names: string[];
|
|
404
|
+
} | {
|
|
405
|
+
kind: 'mark';
|
|
406
|
+
side: 'from' | 'to';
|
|
407
|
+
paragraph: Element<wml.P>;
|
|
408
|
+
container: Element[];
|
|
409
|
+
names: string[];
|
|
410
|
+
}
|
|
411
|
+
/** Anything else directly in a paragraph while a range is open: text typed into moved text, say. */
|
|
412
|
+
| {
|
|
413
|
+
kind: 'inner';
|
|
414
|
+
side: 'from' | 'to';
|
|
415
|
+
element: Element;
|
|
416
|
+
owner: Element[];
|
|
417
|
+
names: string[];
|
|
418
|
+
};
|
|
419
|
+
/**
|
|
420
|
+
* The story a paragraph is in, for its moves: the outermost array of block content above it (a body, a
|
|
421
|
+
* header, a note). A kept `mc:AlternateContent`'s selected branch is part of the story it stands in, as
|
|
422
|
+
* Word reads it; another branch is a story of its own, its list (docx4j's twin stories, its CR-051 phase
|
|
423
|
+
* 2; CR-013 phase 3), so a move is paired within the branch. `value` may be the paragraph or anything in
|
|
424
|
+
* it, a run-level branch's revision among them.
|
|
425
|
+
*/
|
|
426
|
+
export declare function storyOf(value: object): Element[];
|
|
427
|
+
/** Every piece of move markup in a story, in document order, each half and mark with the names of the ranges open over it. */
|
|
428
|
+
export declare function movePiecesOf(story: Element[]): MovePiece[];
|
|
175
429
|
/**
|
|
176
430
|
* The tracked changes of one paragraph, in document order, touching pieces grouped as Office JS
|
|
177
431
|
* groups them (`groupTouching`). Office JS lists the changes that start in the paragraph (check 22):
|
|
@@ -182,11 +436,40 @@ export declare function trackedChangesOfParagraph(paragraph: Paragraph): Tracked
|
|
|
182
436
|
/** Between two tracked changes: something unrevised - text, a paragraph mark, a table - that keeps them apart. */
|
|
183
437
|
export declare const BREAK: "break";
|
|
184
438
|
export type TrackedChangeToken = TrackedChange | typeof BREAK;
|
|
439
|
+
/**
|
|
440
|
+
* How a listing takes the branches of a kept `mc:AlternateContent` (CR-013 phase 3), docx4j's two
|
|
441
|
+
* `Lister`s: `'listed'`, the public listing, lists the selected branch's changes where the element stands
|
|
442
|
+
* and pairs each other branch's with them as twins (`pairTwins`), so that resolving a listed change
|
|
443
|
+
* resolves its twins; `'every'`, resolve-all's, lists every other branch's changes on their own, into
|
|
444
|
+
* `extra`, which the caller puts after the story's, so that each is resolved, matched by a filter on its
|
|
445
|
+
* own, and the selected branch's grouping is the public listing's.
|
|
446
|
+
*/
|
|
447
|
+
export interface Listing {
|
|
448
|
+
mode: 'listed' | 'every';
|
|
449
|
+
extra: TrackedChangeToken[];
|
|
450
|
+
}
|
|
451
|
+
/** The public listing's (`Listing`). */
|
|
452
|
+
export declare function listedListing(): Listing;
|
|
453
|
+
/**
|
|
454
|
+
* A kept `mc:AlternateContent`'s changes: its selected branch's into `into`, as Word reads them, keeping
|
|
455
|
+
* nothing apart (CR-013 phase 2); each other branch's paired with them as twins or, resolve-all's,
|
|
456
|
+
* listed on their own after the story's (`Listing`). `visit` lists one branch's items, at the element's
|
|
457
|
+
* level (blocks, rows, cells or runs).
|
|
458
|
+
*/
|
|
459
|
+
export declare function alternateTokens(ac: mce.AlternateContent, visit: (items: Element[], into: TrackedChangeToken[]) => void, into: TrackedChangeToken[], listing: Listing): void;
|
|
460
|
+
/**
|
|
461
|
+
* Another branch's changes attached to the listed branch's as twins, piece by piece: the n-th single
|
|
462
|
+
* change of a kind with the n-th of that kind, never by id, as docx4j pairs a text box's `mc:Fallback`
|
|
463
|
+
* changes and a branch's (its `Lister.pairTwins`; Word gives twins different ids). docx4j pairs the
|
|
464
|
+
* listed changes, groups included; pieces are paired here, since this listing groups the selected
|
|
465
|
+
* branch's with what touches the element, so a piece resolved on its own resolves its twin too.
|
|
466
|
+
*/
|
|
467
|
+
export declare function pairTwins(primary: readonly TrackedChangeToken[], twins: readonly TrackedChangeToken[]): void;
|
|
185
468
|
/**
|
|
186
469
|
* A paragraph's single changes in document order, its mark last, with a `BREAK` wherever unrevised
|
|
187
470
|
* content stands between two of them: `groupTouching` makes the groups from these.
|
|
188
471
|
*/
|
|
189
|
-
export declare function trackedChangeTokensOfParagraph(paragraph: Paragraph): TrackedChangeToken[];
|
|
472
|
+
export declare function trackedChangeTokensOfParagraph(paragraph: Paragraph, listing?: Listing): TrackedChangeToken[];
|
|
190
473
|
/**
|
|
191
474
|
* Tokens made into the changes Office JS lists: consecutive pieces of one kind (inserted, deleted, or
|
|
192
475
|
* a run's formatting) by one author, nothing unrevised between them, are one change (checks 22, 23
|
|
@@ -200,22 +483,24 @@ export declare function groupTouching(tokens: TrackedChangeToken[]): TrackedChan
|
|
|
200
483
|
* The `w:trPr/w:ins` and `w:trPr/w:del` revisions of a table row. `inner` is the revision markup
|
|
201
484
|
* of the row's own cells, which the row's change owns rather than reporting separately.
|
|
202
485
|
*/
|
|
203
|
-
export declare function trackedChangesOfRow(tr: Element<wml.Tr>, owner: Element[], inner?: TrackedChange[], table?: Located<wml.Tbl
|
|
486
|
+
export declare function trackedChangesOfRow(tr: Element<wml.Tr>, owner: Element[], inner?: TrackedChange[], table?: Located<wml.Tbl>, body?: Body): TrackedChange[];
|
|
204
487
|
/** The change a table's property records make, one per table, or undefined when they make none. */
|
|
205
|
-
export declare function tablePropertiesChangeOf(tbl: Element<wml.Tbl
|
|
488
|
+
export declare function tablePropertiesChangeOf(tbl: Element<wml.Tbl>, body?: Body): TrackedChange | undefined;
|
|
206
489
|
/** A cell's own revision, `w:cellIns` or `w:cellDel`, or undefined. */
|
|
207
|
-
export declare function cellChangeOf(tc: Element<wml.Tc>, owner: Element[], tr: wml.Tr): TrackedChange | undefined;
|
|
490
|
+
export declare function cellChangeOf(tc: Element<wml.Tc>, owner: Element[], tr: wml.Tr, body?: Body): TrackedChange | undefined;
|
|
208
491
|
/** The change to the body's last section (`w:body/w:sectPr/w:sectPrChange`), its text the section's paragraphs'. */
|
|
209
492
|
export declare function bodySectionChangeOf(container: {
|
|
210
493
|
content?: Element[];
|
|
211
494
|
sectPr?: wml.SectPr;
|
|
212
|
-
}): TrackedChange | undefined;
|
|
495
|
+
}, body?: Body): TrackedChange | undefined;
|
|
213
496
|
/**
|
|
214
497
|
* What `acceptAll` and `rejectAll` resolve that is never listed: a `w:cellMerge`, which Office JS
|
|
215
498
|
* cannot list (check 27: `getTrackedChanges` throws); a `w:numberingChange`, which Word no longer
|
|
216
499
|
* writes and drops when one is put in, and whose record is the old number's text, so that a reject
|
|
217
500
|
* too can only drop it; and a table's records that change nothing. A merge rejected gets the merge it
|
|
218
501
|
* recorded back (docx4j's reading; unmeasured). A `w:customXmlInsRangeStart` or `End` left without
|
|
219
|
-
* the form `
|
|
502
|
+
* the form `holderChangeAt` lists marks nothing that can be found, and goes either way. Every branch
|
|
503
|
+
* of a kept `mc:AlternateContent` at block, row and cell level is swept (CR-013 phase 3).
|
|
220
504
|
*/
|
|
221
505
|
export declare function resolveUnlisted(items: Element[], what: 'accept' | 'reject'): void;
|
|
506
|
+
export {};
|