@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
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type * as wml from '@docx4j/generated-objects-ts/modules/org_docx4j_wml';
|
|
2
2
|
import type { CellContext } from '../properties/table.mjs';
|
|
3
|
-
import { type Element, W_NS, type SpanEdges, type SegmentOptions, type TextSegment, type TextViewOptions } from './tree.mjs';
|
|
3
|
+
import { type Element, W_NS, type HiddenRuns, type SpanEdges, type SegmentOptions, type TextSegment, type TextViewOptions } from './tree.mjs';
|
|
4
4
|
import { Font, type FontTracking } from './Font.mjs';
|
|
5
5
|
import { Range } from './Range.mjs';
|
|
6
6
|
import { type SearchOptions } from './search.mjs';
|
|
7
7
|
import type { Body, BlockElement } from './Body.mjs';
|
|
8
8
|
import { type TableCell } from './Table.mjs';
|
|
9
|
-
import { ContentControl, type ContentControlType } from './ContentControl.mjs';
|
|
9
|
+
import { ContentControl, type ContentControlType, type ContentControlOptions } from './ContentControl.mjs';
|
|
10
|
+
import { type LineBreaks } from './officeText.mjs';
|
|
10
11
|
import { InlinePicture, type InlinePictureOptions } from './InlinePicture.mjs';
|
|
11
12
|
import { type CommentContent, type CommentOptions } from './comments.mjs';
|
|
12
13
|
import type { Comment } from './Comment.mjs';
|
|
@@ -64,8 +65,23 @@ export declare class Paragraph {
|
|
|
64
65
|
parentBody: Body);
|
|
65
66
|
/** The paragraph value (docx4j: the P). */
|
|
66
67
|
get p(): wml.P;
|
|
68
|
+
/** @internal A view of another paragraph of this one's body, for a `Range` across paragraphs (CR-014). */
|
|
69
|
+
viewOf(element: Element<wml.P>, container: Element[]): Paragraph;
|
|
70
|
+
/**
|
|
71
|
+
* @internal A range from this paragraph's start to the end of `last`, a later paragraph of the same story, with
|
|
72
|
+
* `last`'s mark where `mark` is set, or `endMark` in its place (CR-014 phase 1).
|
|
73
|
+
*/
|
|
74
|
+
rangeTo(last: Paragraph, mark: boolean, endMark?: string): Range;
|
|
75
|
+
/** How many tables deep the paragraph is: 0 outside a table, 1 in a cell, 2 in a nested table's (Office JS `tableNestingLevel`). */
|
|
76
|
+
get tableNestingLevel(): number;
|
|
67
77
|
get index(): number;
|
|
68
|
-
/**
|
|
78
|
+
/**
|
|
79
|
+
* The paragraph's text as Office JS gives it in Word's default view (CR-012 phase 4, section 6.2):
|
|
80
|
+
* the accepted text, hidden text left out, in Word's characters (check 48: a note reference U+0002,
|
|
81
|
+
* a line break U+000B, a page break U+000C, a column break U+000E, a `w:cr` U+000D, the hyphens
|
|
82
|
+
* U+001E and U+001F, a symbol `(`, an equation as Word draws it). A kept `mc:AlternateContent`
|
|
83
|
+
* reads as its selected branch (check 49). Every offset a `Range` or `search` takes counts in it.
|
|
84
|
+
*/
|
|
69
85
|
get text(): string;
|
|
70
86
|
/** Replaces the content with one run of the text, keeping the first run's formatting. */
|
|
71
87
|
set text(value: string);
|
|
@@ -145,11 +161,12 @@ export declare class Paragraph {
|
|
|
145
161
|
get outlineLevel(): number;
|
|
146
162
|
set outlineLevel(level: number);
|
|
147
163
|
/**
|
|
148
|
-
* The runs' formatting: reads the
|
|
149
|
-
*
|
|
164
|
+
* The runs' formatting: reads the *effective* properties of the runs holding the paragraph's text, `null` (or `''`,
|
|
165
|
+
* `Mixed`) where they differ, and the mark's where it has no text, as Office JS reads them (CR-002 section 59); writes
|
|
166
|
+
* direct formatting to every run (extension: `Font` is over runs, not the paragraph mark).
|
|
150
167
|
*/
|
|
151
168
|
get font(): Font;
|
|
152
|
-
/** `font`, with `{ direct: true }` for the direct formatting
|
|
169
|
+
/** `font`, with `{ direct: true }` for the runs' direct formatting (extension). */
|
|
153
170
|
getFont(options?: FormattingOptions): Font;
|
|
154
171
|
/** w14:paraId, the stable address Word gives paragraphs. */
|
|
155
172
|
get paraId(): string | undefined;
|
|
@@ -160,6 +177,12 @@ export declare class Paragraph {
|
|
|
160
177
|
get parentTableCell(): TableCell | undefined;
|
|
161
178
|
/** The run-level content controls in this paragraph, in order, nested ones included. */
|
|
162
179
|
get contentControls(): ContentControl[];
|
|
180
|
+
/**
|
|
181
|
+
* Office JS `getContentControls` (WordApi 1.5): the content controls `contentControls` lists, those of `options.types`
|
|
182
|
+
* where given. Word's `contentControls` lists rich-text controls only; this package's lists every kind, a recorded
|
|
183
|
+
* departure (CR-002 section 60 G1, check 55b), so this is how add-in code that asks for plain-text controls finds them.
|
|
184
|
+
*/
|
|
185
|
+
getContentControls(options?: ContentControlOptions): ContentControl[];
|
|
163
186
|
/**
|
|
164
187
|
* The inline pictures in this paragraph, in order (Office JS Paragraph.inlinePictures): each
|
|
165
188
|
* `w:drawing` whose `wp:inline` holds a `pic:pic`, in a run or in the selected branch of a kept
|
|
@@ -169,8 +192,14 @@ export declare class Paragraph {
|
|
|
169
192
|
get inlinePictures(): InlinePicture[];
|
|
170
193
|
/** Text inserted at the start, the end, or replacing the whole paragraph's text. */
|
|
171
194
|
insertText(text: string, location: 'Start' | 'End' | 'Replace'): Range;
|
|
172
|
-
/**
|
|
195
|
+
/**
|
|
196
|
+
* A new paragraph of the text before or after this one, with this paragraph's properties (as Word). Beside the only
|
|
197
|
+
* paragraph of a block control showing its placeholder it goes outside the control, as Word's went, and the control
|
|
198
|
+
* stays at block level (CR-002 section 63, D6 (b); check 63 cases 10, 11, 36 and 37).
|
|
199
|
+
*/
|
|
173
200
|
insertParagraph(text: string, location: 'Before' | 'After'): Paragraph;
|
|
201
|
+
/** The block-level control holding this paragraph directly while it shows its placeholder (CR-002 section 63). */
|
|
202
|
+
private get placeholderControl();
|
|
174
203
|
insertBreak(type: 'Page' | 'Line', location: 'Before' | 'After' | 'Start' | 'End'): void;
|
|
175
204
|
/**
|
|
176
205
|
* Adds the image as a part of this paragraph's part, with a relationship, and shows it at the
|
|
@@ -206,21 +235,41 @@ export declare class Paragraph {
|
|
|
206
235
|
/**
|
|
207
236
|
* The paragraph's range: 'Whole' and 'Content' hold its whole content, the pictures at its start and
|
|
208
237
|
* end among them, so deleting it deletes them (CR-002 section 48); 'Start' and 'End' are collapsed.
|
|
238
|
+
* 'Whole' holds the paragraph's mark too, so its `text` ends with `markText`, as Office JS's does
|
|
239
|
+
* (check 48); 'Content' ends with the paragraph's text.
|
|
209
240
|
*/
|
|
210
241
|
getRange(location?: 'Whole' | 'Start' | 'End' | 'Content'): Range;
|
|
242
|
+
/**
|
|
243
|
+
* The character Office JS gives for this paragraph's mark at the end of its 'Whole' range (check 48):
|
|
244
|
+
* `\t` for the last paragraph of a table cell, the cell's end; nothing for a mark tracked as deleted, which
|
|
245
|
+
* Word's default view doesn't show (CR-012 section 19, check 58); and `\r` for any other.
|
|
246
|
+
*/
|
|
247
|
+
get markText(): string;
|
|
211
248
|
/**
|
|
212
249
|
* Removes the paragraph from its container. While the package tracks changes, the content
|
|
213
250
|
* becomes a `w:del` and the mark is marked deleted (`w:pPr/w:rPr/w:del`) instead, unless the
|
|
214
251
|
* whole paragraph was this author's own insertion, which Word simply takes back.
|
|
252
|
+
* The paragraph a table cell ends with, as Word reads it, stays where removing it would leave the
|
|
253
|
+
* cell without one, emptied, its properties kept; tracked, its mark is never marked deleted, as Word
|
|
254
|
+
* keeps a cell's last paragraph (check 52, cases 88 to 91; CR-002 section 55.6).
|
|
215
255
|
*/
|
|
216
256
|
delete(): void;
|
|
257
|
+
/**
|
|
258
|
+
* `delete()`; with `keepCellEnd` false a cell's last paragraph goes as any other, for `Body.clearContent`'s
|
|
259
|
+
* callers, which put their own paragraph in next.
|
|
260
|
+
* @internal
|
|
261
|
+
*/
|
|
262
|
+
remove(keepCellEnd: boolean): void;
|
|
263
|
+
/** Whether the cell this paragraph was in ends with a paragraph without it, as Word reads it (CR-002 section 55). */
|
|
264
|
+
private cellStillEnds;
|
|
217
265
|
private trackedDelete;
|
|
218
266
|
/**
|
|
219
267
|
* The paragraph's content and its mark marked deleted, the paragraph element itself kept:
|
|
220
268
|
* what the cells of a deleted table row need (a `w:tc` must keep a block-level child, and Word
|
|
221
269
|
* writes `w:del` around every run and `w:pPr/w:rPr/w:del` on every mark inside a deleted row).
|
|
222
270
|
* The same primitives `delete()` uses, without its "take back my own insertion" step.
|
|
223
|
-
*
|
|
271
|
+
* A mark already deleted is left as it is, and the text is deleted still: a paragraph another author's
|
|
272
|
+
* deletion ended keeps text a range's deletion across it must take (CR-014 phase 2).
|
|
224
273
|
*/
|
|
225
274
|
markDeletedInPlace(tracker: ChangeTracker): void;
|
|
226
275
|
/**
|
|
@@ -268,8 +317,31 @@ export declare class Paragraph {
|
|
|
268
317
|
get changeTracker(): ChangeTracker | undefined;
|
|
269
318
|
/** What `Font` needs to write `w:rPrChange`: the tracker, and the runs that are our own insertion (`Range` shares it). */
|
|
270
319
|
fontTracking(): FontTracking | undefined;
|
|
271
|
-
/**
|
|
320
|
+
/**
|
|
321
|
+
* The text segments (w:t, w:tab, ...) with their offsets in `text`; `{ objects: true }` adds the
|
|
322
|
+
* pictures and the hidden runs' items.
|
|
323
|
+
*/
|
|
272
324
|
segments(options?: SegmentOptions): TextSegment[];
|
|
325
|
+
/**
|
|
326
|
+
* True for a paragraph in a text box (`w:txbxContent`), at a `textbox:` address (CR-012 D4). Such a view
|
|
327
|
+
* reads as any paragraph does and is read-only (D5): every write throws `NotSupportedError`.
|
|
328
|
+
*/
|
|
329
|
+
get inTextBox(): boolean;
|
|
330
|
+
/**
|
|
331
|
+
* Refuses a write to a paragraph in a text box (CR-012 D5): a box is in each branch of its
|
|
332
|
+
* `mc:AlternateContent`, `wps:txbx` in the Choice and `v:textbox` in the Fallback, and nothing maps the
|
|
333
|
+
* one's paragraphs to the other's, so an edit could not reach every branch as CR-010's D2 has mutators do.
|
|
334
|
+
* And a write to a paragraph in a branch of a kept `mc:AlternateContent` at block, row or cell level
|
|
335
|
+
* (CR-013 D4), for the same reason. Internal: the content API's mutators call it first.
|
|
336
|
+
*/
|
|
337
|
+
assertWritable(): void;
|
|
338
|
+
/**
|
|
339
|
+
* True for a paragraph in the selected branch of a kept `mc:AlternateContent` at block, row or cell
|
|
340
|
+
* level, which readers see as Word does (CR-013 phase 2). Such a view is read-only (D4).
|
|
341
|
+
*/
|
|
342
|
+
get inBranch(): boolean;
|
|
343
|
+
/** Which of this paragraph's runs are hidden: a run's own `w:vanish`, else its styles' (CR-012 phase 4). */
|
|
344
|
+
hiddenRuns(): HiddenRuns;
|
|
273
345
|
/**
|
|
274
346
|
* Replaces the text in [start, end) with `text` and returns the range of the inserted text.
|
|
275
347
|
* Runs are edited in place: a w:t loses or gains characters, a tab or break inside the range
|
|
@@ -280,7 +352,69 @@ export declare class Paragraph {
|
|
|
280
352
|
* says the span holds (`WHOLE` for a paragraph's whole content), so a span of no text can still
|
|
281
353
|
* delete a picture (CR-002 section 48).
|
|
282
354
|
*/
|
|
283
|
-
splice(start: number, end: number, text: string, prefer?: 'before' | 'after', edges?: SpanEdges): Range;
|
|
355
|
+
splice(start: number, end: number, text: string, prefer?: 'before' | 'after', edges?: SpanEdges, lineBreaks?: LineBreaks): Range;
|
|
356
|
+
/**
|
|
357
|
+
* The controls bound by `w:dataBinding` that [start, end) is in: those holding the paragraph, and the run-level ones
|
|
358
|
+
* holding text there.
|
|
359
|
+
*/
|
|
360
|
+
private boundControlsAt;
|
|
361
|
+
/**
|
|
362
|
+
* @internal Text written at the paragraph's End by Office JS's routes to it: `insertText('End')`, its End range at any
|
|
363
|
+
* location, its Content range's End and After, and so a body's or a cell's `insertText('End')` (CR-002 sections 63.24
|
|
364
|
+
* to 63.27; checks 69 and 70). As Word writes it (D12): after everything the paragraph holds, into none of it - a
|
|
365
|
+
* run-level control, a link, a revision, a field, a bookmark's or a comment's markers, a text box - in a run of its
|
|
366
|
+
* own, or the last run extended. The text takes the last item's run properties where that item is a run holding text,
|
|
367
|
+
* so after a hidden run it is hidden and its range reads nothing (D13); otherwise it has none, and with `plain` (the End
|
|
368
|
+
* range's After, D14) none either. Word's proofing marks, `w:proofErr`, are no item (a choice: Word redoes them).
|
|
369
|
+
* Tracked, the run is a `w:ins`, or joins this author's own `w:ins` where one ends the paragraph. A line break makes
|
|
370
|
+
* paragraphs, as `splice` does (CR-002 section 60 E1); text so broken after a hidden run is written visible (a choice,
|
|
371
|
+
* unmeasured).
|
|
372
|
+
*/
|
|
373
|
+
writeAtEnd(text: string, plain?: boolean): Range;
|
|
374
|
+
/**
|
|
375
|
+
* `items` put at `at` in `list` (its end by default): onto the end of `run`, which is in `list` right before `at`,
|
|
376
|
+
* merging into its last `w:t`, or as a new run in its properties where `run` is undefined. Returns the run written.
|
|
377
|
+
*/
|
|
378
|
+
private appendTo;
|
|
379
|
+
/** `splice`'s write. */
|
|
380
|
+
private spliceWrite;
|
|
381
|
+
/**
|
|
382
|
+
* Text of several lines put in place of [start, end) as Word's insertText puts it (CR-002 section 60 E1): the lines'
|
|
383
|
+
* text, then a paragraph break after each line but the last, the paragraphs keeping this one's properties; tracked,
|
|
384
|
+
* each new mark inserted. Refused before anything changes where a paragraph can't be split there.
|
|
385
|
+
*/
|
|
386
|
+
private spliceLines;
|
|
387
|
+
/** @internal Refuses, before anything changes, a paragraph break at `at` where none can be made (E1; `Range`'s Replace across paragraphs). */
|
|
388
|
+
assertBreakableAt(at: number, prefer: 'before' | 'after'): void;
|
|
389
|
+
/**
|
|
390
|
+
* The segment text put at `at` goes into, as `spliceText` chooses it: a replacement's, the one holding the first
|
|
391
|
+
* replaced character; else the one containing `at`, else the nearer neighbour.
|
|
392
|
+
*/
|
|
393
|
+
private landingSegment;
|
|
394
|
+
/** The run-level content control a segment's run is in, the innermost, as a view; undefined for none. */
|
|
395
|
+
private runControlOf;
|
|
396
|
+
/** The block-level content control holding this paragraph directly, as a view; undefined for none. */
|
|
397
|
+
get blockControl(): ContentControl | undefined;
|
|
398
|
+
/**
|
|
399
|
+
* Refuses, before anything changes, a paragraph break where the text lands inside something a paragraph can't be
|
|
400
|
+
* split in: a content control, an equation, a kept mc:AlternateContent (CR-002 section 60 E1, as `splitParagraph`
|
|
401
|
+
* refuses one). A field's result is split: a complex field's runs across the paragraphs, a `w:fldSimple` made a
|
|
402
|
+
* complex field first (section 62.2 D1).
|
|
403
|
+
*/
|
|
404
|
+
private assertBreakable;
|
|
405
|
+
/**
|
|
406
|
+
* The characters of [from, to) that are elements written as the elements they read as (CR-002 section 60 D1), each
|
|
407
|
+
* in its run where it stood: a w:t holding one is cut around it. Characters outside the span are left as they are.
|
|
408
|
+
*/
|
|
409
|
+
private writeElements;
|
|
410
|
+
/**
|
|
411
|
+
* The first run's properties, for text with no run beside it to take its look from; none where that run is hidden,
|
|
412
|
+
* so that text put into a paragraph whose every run is hidden can be seen (CR-002 section 60: the text was hidden
|
|
413
|
+
* with it, so read as nothing, and its characters escaped the map).
|
|
414
|
+
*/
|
|
415
|
+
private visibleFirstRunRPr;
|
|
416
|
+
/** `splice` before section 60: the text put in as it is, as one stretch of a w:t's text. */
|
|
417
|
+
private spliceText;
|
|
284
418
|
/**
|
|
285
419
|
* Inserts run-level items (runs, hyperlinks, content controls) at a text offset, splitting the
|
|
286
420
|
* run there when the offset falls inside one. PARENT is linked on what is inserted.
|
|
@@ -288,6 +422,16 @@ export declare class Paragraph {
|
|
|
288
422
|
insertItemsAt(offset: number, items: Element[]): void;
|
|
289
423
|
/** Splits the run at a text offset so that [offset, ...) begins a run; returns nothing when the offset is already a boundary. */
|
|
290
424
|
splitAt(offset: number): void;
|
|
425
|
+
/**
|
|
426
|
+
* Splits `seg`'s run so that the items of `owner` from `index` on begin a run of their own, behind it.
|
|
427
|
+
* `owner` is the run's content, or the selected branch of a run-level `mc:AlternateContent` in it
|
|
428
|
+
* (CR-012 section 12.2): a run holds the element whole, so the branch splits with it, as the editor's
|
|
429
|
+
* ED-009 section 3.4 has it. The first piece keeps the element, its other branches as they were; the
|
|
430
|
+
* second gets an element of its own, the same branches in the same order with the same `Requires`, the
|
|
431
|
+
* selected one holding the rest of its items and the others empty, so that a reader taking any branch
|
|
432
|
+
* takes the same one in both. The run's items after the element go with the second piece.
|
|
433
|
+
*/
|
|
434
|
+
private splitRunAtItem;
|
|
291
435
|
/**
|
|
292
436
|
* Office JS `paragraph.isListItem`: whether Word paints a label in front of this paragraph.
|
|
293
437
|
* The effective `w:numPr` decides it (docx4j `Emulator.numRefFor`), so a "List Number" style
|
|
@@ -337,10 +481,28 @@ export declare class Paragraph {
|
|
|
337
481
|
* turned into `w:delText`, and each run of consecutive ones moved into one `w:del`. Text this
|
|
338
482
|
* author had inserted is simply removed, as Word does, rather than nested in a `w:del`.
|
|
339
483
|
* The pictures in the span (`splice`'s `edges`) are deleted with the text, each in a run of its own
|
|
340
|
-
* where its run held more, as `InlinePicture.delete` gives it one (CR-002 section 48).
|
|
484
|
+
* where its run held more, as `InlinePicture.delete` gives it one (CR-002 section 48). An equation is deleted where
|
|
485
|
+
* it stands, in Word's form, a `w:del` in each math run and each structure's `m:ctrlPr` (`markEquationDeleted`;
|
|
486
|
+
* section 62.2 D2), the runs either side in `w:del`s of their own; one holding a revision of its own goes into the
|
|
487
|
+
* `w:del` whole, as every equation did before.
|
|
341
488
|
* Returns the `w:del` elements it made, in document order.
|
|
342
489
|
*/
|
|
343
490
|
private deleteText;
|
|
491
|
+
/**
|
|
492
|
+
* The run-level controls showing their placeholder that [start, end) holds whole: where the walk passes one strictly
|
|
493
|
+
* inside the span, or at an edge `edges` says it holds. A placeholder is no text, so such a control has no width
|
|
494
|
+
* (CR-002 section 63, D3).
|
|
495
|
+
*/
|
|
496
|
+
private placeholderControlsIn;
|
|
497
|
+
/**
|
|
498
|
+
* The runs of comments' references in [start, end): each a run holding nothing but a reference, where the walk
|
|
499
|
+
* passes it, strictly inside the span or at an edge `edges` says it holds. A reference has no text, so a
|
|
500
|
+
* deletion's segments never held it, and a comment whose reference a deletion took stayed. Word's deletion takes
|
|
501
|
+
* it with the text (check 54 cases 27 and 28; CR-014 section 12.6).
|
|
502
|
+
*/
|
|
503
|
+
private commentReferencesIn;
|
|
504
|
+
/** A comment queued to go when the package is saved, its markers, replies and entries with it, as a resolution queues one. */
|
|
505
|
+
private queueCommentRemoval;
|
|
344
506
|
/**
|
|
345
507
|
* Splits the revision that holds the text at `at` into two - the second half a copy of its
|
|
346
508
|
* attributes under a new `w:id` - and puts `item` between them. Word splits a revision so when
|
|
@@ -382,6 +544,11 @@ export declare class Paragraph {
|
|
|
382
544
|
* are split there: never inside another's revision.
|
|
383
545
|
*/
|
|
384
546
|
private placeInsertion;
|
|
547
|
+
/**
|
|
548
|
+
* Splits runs so that every run holding text in [start, end) holds nothing else (internal: what a
|
|
549
|
+
* `Range.font` write formats). A kept `mc:AlternateContent`'s branch splits with its run (section 12.2).
|
|
550
|
+
*/
|
|
551
|
+
splitRunsAround(start: number, end: number): void;
|
|
385
552
|
/**
|
|
386
553
|
* Splits runs so that every run holding text in [start, end) holds nothing else, and returns
|
|
387
554
|
* the segments inside the span. `splitAt` does the `w:t` boundaries; this also moves the items
|
|
@@ -390,9 +557,18 @@ export declare class Paragraph {
|
|
|
390
557
|
* holding one holds nothing outside the span either.
|
|
391
558
|
*/
|
|
392
559
|
private isolate;
|
|
393
|
-
/**
|
|
560
|
+
/**
|
|
561
|
+
* Refuses an edit that would cut an equation (CR-012 phase 4). Its text is one segment, Word's drawing of
|
|
562
|
+
* its math runs (`mathTextOf`), so an edit may take it whole but not part of it, nor insert into it. Under change
|
|
563
|
+
* tracking a deletion takes it whole in Word's form (`deleteText`, CR-002 section 62.2 D2, check 57), and a
|
|
564
|
+
* replacement doesn't take it at all: where Word puts the new text beside a deleted equation isn't measured. Since
|
|
565
|
+
* phase 4 every other offset is a place in the runs: `text` is the segments' text, where before it was the objects
|
|
566
|
+
* package's `textOf` and section 12.4 refused an offset past a kept `mc:AlternateContent` among the runs.
|
|
567
|
+
*/
|
|
568
|
+
private assertPlaceable;
|
|
569
|
+
/** Moves the items before `seg` into a run of their own, in front of the rest; false where there are none. */
|
|
394
570
|
private splitRunBefore;
|
|
395
|
-
/** Moves the items after `seg` into a run of their own, behind
|
|
571
|
+
/** Moves the items after `seg` into a run of their own, behind it; false where there are none. */
|
|
396
572
|
private splitRunAfter;
|
|
397
573
|
}
|
|
398
574
|
type RevisionHolderOf = NonNullable<TextSegment['revision']>;
|