@docx-editor.dev/editor-api 2.26.0 → 2.28.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/OFFICE_JS_GUIDE.md +75 -4
- package/README.md +1 -1
- package/dist/browser.d.mts +3 -4
- package/dist/browser.d.ts +3 -4
- package/dist/browser.js +1 -1
- package/dist/browser.mjs +1 -1
- package/dist/index.d.mts +3 -4
- package/dist/index.d.ts +3 -4
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{server-7L_4anGB.d.mts → server-By7dFq5s.d.mts} +123 -19
- package/dist/{server-7L_4anGB.d.ts → server-By7dFq5s.d.ts} +123 -19
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AutomationHandle, AutomationSpan, AutomationOperation, AutomationValue, AutomationSpanRef, RevisionBatchResult, AutomationHost, AutomationCapabilities, AutomationPaginationOptions } from '@docx-editor.dev/core/automation';
|
|
1
|
+
import { AutomationHandle, AutomationSpan, AutomationOperation, AutomationValue, AutomationSpanRef, RevisionBatchResult, RevisionAuthorResult, AutomationHost, AutomationCapabilities, AutomationPaginationOptions } from '@docx-editor.dev/core/automation';
|
|
2
2
|
import { CollaborationModuleContribution } from '@docx-editor.dev/core/collaboration';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -1352,7 +1352,25 @@ declare class Revision extends ModelObject implements PromisedItem {
|
|
|
1352
1352
|
/** @internal Plan the read this object's `load(...)` asked for. */
|
|
1353
1353
|
protected onLoad(request: ResolvedLoadOptions): void;
|
|
1354
1354
|
/** @internal Capture a batch target without exposing engine identity. */
|
|
1355
|
-
static batchHandle(revision: Revision, context: RequestContext): AutomationHandle;
|
|
1355
|
+
static batchHandle(revision: Revision, context: RequestContext, target?: string): AutomationHandle;
|
|
1356
|
+
}
|
|
1357
|
+
/**
|
|
1358
|
+
* Select every change these authors made, for {@link RevisionCollection.setAuthor}.
|
|
1359
|
+
* Matches `w:author` exactly.
|
|
1360
|
+
*
|
|
1361
|
+
* @public
|
|
1362
|
+
*/
|
|
1363
|
+
interface RevisionAuthorSelection {
|
|
1364
|
+
readonly authors: readonly string[];
|
|
1365
|
+
}
|
|
1366
|
+
/**
|
|
1367
|
+
* Options for {@link RevisionCollection.setAuthor}.
|
|
1368
|
+
*
|
|
1369
|
+
* @public
|
|
1370
|
+
*/
|
|
1371
|
+
interface RevisionAuthorOptions {
|
|
1372
|
+
/** The date to record. Omit it to keep each change's own date. */
|
|
1373
|
+
readonly date?: Date;
|
|
1356
1374
|
}
|
|
1357
1375
|
/**
|
|
1358
1376
|
* The tracked changes on a document, story or range, as of the batch that loaded them.
|
|
@@ -1395,6 +1413,23 @@ declare class RevisionCollection extends HandleCollection<Revision> {
|
|
|
1395
1413
|
* ```
|
|
1396
1414
|
*/
|
|
1397
1415
|
resolve(action: 'accept' | 'reject', revisions?: readonly Revision[]): ClientResult<RevisionBatchResult>;
|
|
1416
|
+
/**
|
|
1417
|
+
* Attribute changes in this story to another author. The changes stay pending.
|
|
1418
|
+
*
|
|
1419
|
+
* Pass revision objects to change those changes, or `{ authors }` to change every change
|
|
1420
|
+
* those authors made. Omit the selection to change every change in the story, by every
|
|
1421
|
+
* author, including structural ones absent from `items`. An empty array selects nothing.
|
|
1422
|
+
* Each change keeps its date unless you pass `options.date`. Keep this the only write in
|
|
1423
|
+
* its sync batch. Revision objects you pass stay valid and read the new author after a load.
|
|
1424
|
+
*
|
|
1425
|
+
* @example
|
|
1426
|
+
* ```ts
|
|
1427
|
+
* const result = context.document.revisions.setAuthor('Ada Lovelace', { authors: ['AI'] });
|
|
1428
|
+
* await context.sync();
|
|
1429
|
+
* console.log(result.value.updated.length, result.value.skipped);
|
|
1430
|
+
* ```
|
|
1431
|
+
*/
|
|
1432
|
+
setAuthor(author: string, selection?: readonly Revision[] | RevisionAuthorSelection, options?: RevisionAuthorOptions): ClientResult<RevisionAuthorResult>;
|
|
1398
1433
|
/** @internal The read that answers this collection's members. */
|
|
1399
1434
|
protected listing(): AutomationOperation;
|
|
1400
1435
|
/** @internal Build one member from an address the listing answered. */
|
|
@@ -1438,10 +1473,12 @@ interface SearchOptions {
|
|
|
1438
1473
|
* A range is a SNAPSHOT, not a tracked region. Its endpoints name the paragraphs they were found
|
|
1439
1474
|
* in and the offsets they were found at, so it stays meaningful across edits ELSEWHERE in the
|
|
1440
1475
|
* document and becomes an explicit `InvalidObjectPath` refusal once one of its paragraphs is
|
|
1441
|
-
* gone. What it deliberately does not do is follow edits INSIDE itself:
|
|
1442
|
-
*
|
|
1443
|
-
*
|
|
1444
|
-
*
|
|
1476
|
+
* gone. What it deliberately does not do is follow edits INSIDE itself: once its paragraph
|
|
1477
|
+
* gains a word at offset 0, a range over `"alpha"` fails with `StaleDocument` when used, rather
|
|
1478
|
+
* than reading or editing whatever now sits at offsets 0..5. Edits after the range, and formatting
|
|
1479
|
+
* changes, keep it valid. Word's own ranges do move, by keeping a live region in the document;
|
|
1480
|
+
* this API has none, and pretending otherwise would answer text from a place the caller was not
|
|
1481
|
+
* looking at.
|
|
1445
1482
|
*
|
|
1446
1483
|
* That is also why `start` and `end` are absent rather than unimplemented — they are
|
|
1447
1484
|
* document-wide character positions, a different addressing scheme from this API's paragraph
|
|
@@ -1516,7 +1553,15 @@ declare class Range extends ModelObject implements PromisedItem {
|
|
|
1516
1553
|
* gets back is a range naming the text that was written, in every case.
|
|
1517
1554
|
*/
|
|
1518
1555
|
insertText(text: string, insertLocation: InsertLocation | 'Replace' | 'Start' | 'End' | 'Before' | 'After'): Range;
|
|
1519
|
-
/**
|
|
1556
|
+
/**
|
|
1557
|
+
* Delete range content.
|
|
1558
|
+
*
|
|
1559
|
+
* With `TrackMineOnly`, text becomes deleted runs and each paragraph mark the range covers
|
|
1560
|
+
* becomes a deleted paragraph mark, also in collaboration. Marks that `Paragraph.delete()`
|
|
1561
|
+
* refuses to strike refuse here with the same codes. A tracked deletion or replacement that
|
|
1562
|
+
* starts a paragraph whose previous mark you already proposed deleting refuses with
|
|
1563
|
+
* `NotImplemented`.
|
|
1564
|
+
*/
|
|
1520
1565
|
delete(): void;
|
|
1521
1566
|
/** Clear this range's content, preserving the surrounding structure. */
|
|
1522
1567
|
clear(): void;
|
|
@@ -1553,7 +1598,11 @@ declare class Range extends ModelObject implements PromisedItem {
|
|
|
1553
1598
|
get inlinePictures(): InlinePictureCollection;
|
|
1554
1599
|
/** Insert a bounded PNG/JPEG image. Sync before configuring the returned picture. */
|
|
1555
1600
|
insertInlinePictureFromBase64(base64EncodedImage: string, insertLocation: InsertLocation | 'Before' | 'After' | 'Start' | 'End' | 'Replace'): InlinePicture;
|
|
1556
|
-
/**
|
|
1601
|
+
/**
|
|
1602
|
+
* Line, page, and next-page section breaks are supported; other break types refuse at sync.
|
|
1603
|
+
* TrackMineOnly records a line break as a tracked insertion. Page and section breaks refuse
|
|
1604
|
+
* while tracking.
|
|
1605
|
+
*/
|
|
1557
1606
|
insertBreak(breakType: BreakType | 'Page' | 'SectionNext' | 'Next' | 'Line' | 'SectionContinuous' | 'SectionEven' | 'SectionOdd', insertLocation: InsertLocation.before | InsertLocation.after | 'Before' | 'After'): void;
|
|
1558
1607
|
/**
|
|
1559
1608
|
* Insert a rectangular table before or after this range.
|
|
@@ -1582,6 +1631,12 @@ declare class Range extends ModelObject implements PromisedItem {
|
|
|
1582
1631
|
|
|
1583
1632
|
/** Paragraph alignment values readable and writable through this object model. */
|
|
1584
1633
|
type ParagraphAlignment = Alignment | 'Mixed' | 'Unknown' | 'Left' | 'Centered' | 'Right' | 'Justified';
|
|
1634
|
+
/**
|
|
1635
|
+
* A paragraph's base direction, as {@link Paragraph.readingOrder} reads and writes it.
|
|
1636
|
+
*
|
|
1637
|
+
* @public
|
|
1638
|
+
*/
|
|
1639
|
+
type ParagraphReadingOrder = 'LeftToRight' | 'RightToLeft';
|
|
1585
1640
|
/**
|
|
1586
1641
|
* One paragraph: what it says, what it is, and the ways it can be changed.
|
|
1587
1642
|
*
|
|
@@ -1641,6 +1696,21 @@ declare class Paragraph extends ModelObject implements PromisedItem {
|
|
|
1641
1696
|
*/
|
|
1642
1697
|
get alignment(): ParagraphAlignment;
|
|
1643
1698
|
set alignment(value: ParagraphAlignment);
|
|
1699
|
+
/**
|
|
1700
|
+
* The direction the paragraph reads in: `LeftToRight` or `RightToLeft`.
|
|
1701
|
+
*
|
|
1702
|
+
* A DocxEditor addition: Office.js has no paragraph direction member. The values follow
|
|
1703
|
+
* `Word.SectionDirection`. The read resolves the paragraph's own `w:bidi`, then its style, its
|
|
1704
|
+
* list level, an enclosing cell's table style, and the document defaults, as the page shows them.
|
|
1705
|
+
*
|
|
1706
|
+
* A write changes nothing when the paragraph already reads that way. Otherwise it removes the
|
|
1707
|
+
* paragraph's own direction when that alone set the other one, or states the asked direction,
|
|
1708
|
+
* which also overrides a style. The write keeps `alignment` as authored: in a right-to-left
|
|
1709
|
+
* paragraph, `Left` and `Right` name the start and end edges. With change tracking on, a write
|
|
1710
|
+
* that changes the direction is recorded as a paragraph formatting revision.
|
|
1711
|
+
*/
|
|
1712
|
+
get readingOrder(): ParagraphReadingOrder;
|
|
1713
|
+
set readingOrder(value: ParagraphReadingOrder);
|
|
1644
1714
|
/** Points. Negative for a hanging indent — the first line starting left of the rest. */
|
|
1645
1715
|
get firstLineIndent(): number;
|
|
1646
1716
|
set firstLineIndent(value: number);
|
|
@@ -1679,7 +1749,23 @@ declare class Paragraph extends ModelObject implements PromisedItem {
|
|
|
1679
1749
|
get listItem(): ListItem;
|
|
1680
1750
|
/** Empty this paragraph's text, leaving the paragraph itself where it is. */
|
|
1681
1751
|
clear(): void;
|
|
1682
|
-
/**
|
|
1752
|
+
/**
|
|
1753
|
+
* Remove this paragraph and everything in it.
|
|
1754
|
+
*
|
|
1755
|
+
* With `document.changeTrackingMode = 'TrackMineOnly'`, this records a tracked deletion of the
|
|
1756
|
+
* paragraph's text and its paragraph mark. Accepting it removes the paragraph; rejecting it
|
|
1757
|
+
* restores the paragraph.
|
|
1758
|
+
*
|
|
1759
|
+
* A tracked deletion refuses with `NotSupported` for the last paragraph of a story, table
|
|
1760
|
+
* cell, or content control; a paragraph directly before a table or block content control; a
|
|
1761
|
+
* paragraph whose mark ends a section; a paragraph with an inline content control; a
|
|
1762
|
+
* paragraph with a complex field boundary whose matching boundary is in another paragraph;
|
|
1763
|
+
* and a paragraph that nests inline content more than 64 levels deep. It refuses with
|
|
1764
|
+
* `NotImplemented` when the paragraph or the start of the next paragraph has a pending change,
|
|
1765
|
+
* including your own. Delete adjacent paragraphs in one sync:
|
|
1766
|
+
* a later sync beside your own pending deletion refuses, because the two would review as one
|
|
1767
|
+
* decision. A refusal refuses the whole sync.
|
|
1768
|
+
*/
|
|
1683
1769
|
delete(): void;
|
|
1684
1770
|
/** Write text over this paragraph or at either edge of it. Answers the written text's range. */
|
|
1685
1771
|
insertText(text: string, insertLocation: InsertLocation.replace | InsertLocation.start | InsertLocation.end | 'Replace' | 'Start' | 'End'): Range;
|
|
@@ -1907,11 +1993,12 @@ declare class PageSetup extends ModelObject {
|
|
|
1907
1993
|
* {@link Section.pageSetup}. The section itself is mostly navigation: the story it governs, the
|
|
1908
1994
|
* header and footer stories it declares, and the section after it.
|
|
1909
1995
|
*
|
|
1910
|
-
* `getHeader` and `getFooter` answer a body that may not exist yet
|
|
1911
|
-
*
|
|
1912
|
-
*
|
|
1913
|
-
*
|
|
1914
|
-
* exists only because it was asked about is a header the
|
|
1996
|
+
* `getHeader` and `getFooter` answer a body that may not exist yet. A section with no first-page
|
|
1997
|
+
* header inherits the previous section's. When no section declares one, the answer is an empty
|
|
1998
|
+
* body: every read on it answers as an empty story, and asking does not create the part. The
|
|
1999
|
+
* first text written into it creates the header or footer; asking alone would make a READ write
|
|
2000
|
+
* to the document, and a header that exists only because it was asked about is a header the
|
|
2001
|
+
* author never added.
|
|
1915
2002
|
*
|
|
1916
2003
|
* @public
|
|
1917
2004
|
*/
|
|
@@ -2444,7 +2531,11 @@ type DocxEditorErrorCode =
|
|
|
2444
2531
|
| 'InvalidRequestContext'
|
|
2445
2532
|
/** The runtime was disposed. Every later operation fails this way. */
|
|
2446
2533
|
| 'RuntimeDisposed'
|
|
2447
|
-
/**
|
|
2534
|
+
/**
|
|
2535
|
+
* The request was built from an older read, so nothing was applied: another writer moved the
|
|
2536
|
+
* document, or a range's text moved since the range was read, including by this context's own
|
|
2537
|
+
* earlier sync. Read again before retrying.
|
|
2538
|
+
*/
|
|
2448
2539
|
| 'StaleDocument'
|
|
2449
2540
|
/** The host is live but holds no document right now — an editor between mounts. */
|
|
2450
2541
|
| 'DocumentUnavailable'
|
|
@@ -2503,7 +2594,16 @@ declare class DocxEditorError extends Error {
|
|
|
2503
2594
|
readonly limit?: DocxEditorErrorInit['limit'];
|
|
2504
2595
|
/** Consumer-facing path of the object or property involved, when there is one to name. */
|
|
2505
2596
|
readonly target?: string;
|
|
2506
|
-
/**
|
|
2597
|
+
/**
|
|
2598
|
+
* For `StaleDocument`: the revision the context had last read at, when the refused batch
|
|
2599
|
+
* wrote. Absent for a batch that only read, on every host.
|
|
2600
|
+
*
|
|
2601
|
+
* When it equals {@link DocxEditorError.actualRevision}, the document is where this context
|
|
2602
|
+
* last saw it, and a range it holds is out of date: an edit after the range was read (often
|
|
2603
|
+
* this context's own earlier sync) moved its text. Search for the text again. When the two
|
|
2604
|
+
* differ, another writer changed the document after this context's last read. Read again
|
|
2605
|
+
* before you decide.
|
|
2606
|
+
*/
|
|
2507
2607
|
readonly expectedRevision?: number;
|
|
2508
2608
|
/** For `StaleDocument`: the revision the document was actually at. */
|
|
2509
2609
|
readonly actualRevision?: number;
|
|
@@ -2723,7 +2823,11 @@ interface DocumentZipLimits {
|
|
|
2723
2823
|
readonly maxEntries: number;
|
|
2724
2824
|
/** Most bytes the archive may decompress to in total. */
|
|
2725
2825
|
readonly maxTotalBytes: number;
|
|
2726
|
-
/**
|
|
2826
|
+
/**
|
|
2827
|
+
* Highest tolerated ratio of the archive's total uncompressed bytes to its own byte
|
|
2828
|
+
* length — the zip-bomb guard. Applies once the total exceeds 8 MiB, so a small
|
|
2829
|
+
* archive is never refused for compressing well.
|
|
2830
|
+
*/
|
|
2727
2831
|
readonly maxRatio?: number;
|
|
2728
2832
|
}
|
|
2729
2833
|
/** Resource limits for each parsed XML part. */
|
|
@@ -2794,5 +2898,5 @@ interface CreateServerOptions {
|
|
|
2794
2898
|
/** Options for {@link createCollaborative}. @public */
|
|
2795
2899
|
type CreateCollaborativeOptions = CreateServerOptions;
|
|
2796
2900
|
|
|
2797
|
-
export { Alignment as A, DocxEditorError as E, Field as J, FieldCollection as K, FieldType as L, Font as N, InlinePicture as P, InlinePictureCollection as Q, InsertLocation as R, List as S, ListBullet as T, ListCollection as U, ListItem as V, ListNumbering as W, NoteItem as Z, NoteItemCollection as _, PageOrientation as a0, PageSetup as a1, Paragraph as a2, ParagraphCollection as a4, Range as
|
|
2798
|
-
export type { NoteItemType as $, BesideLocation as B, CreateServerOptions as C, DocxEditorServerRuntime as D, DocxEditorErrorCode as F, DocxEditorErrorInit as G, DocxEditorRuntime as H, EditorModule as I, FieldTypeLiteral as M, HeaderFooterType as O, LoadOption as X, LoadQueryOptions as Y, CreateCollaborativeOptions as a, ParagraphAlignment as a3, ParagraphInsertTextLocation as a5, RangeInsertTextLocation as
|
|
2901
|
+
export { Alignment as A, DocxEditorError as E, Field as J, FieldCollection as K, FieldType as L, Font as N, InlinePicture as P, InlinePictureCollection as Q, InsertLocation as R, List as S, ListBullet as T, ListCollection as U, ListItem as V, ListNumbering as W, NoteItem as Z, NoteItemCollection as _, PageOrientation as a0, PageSetup as a1, Paragraph as a2, ParagraphCollection as a4, Range as a7, RangeCollection as a8, isDocxEditorError as aA, RemoveDocInfoType as aa, RequestContext as ab, Revision as ac, RevisionCollection as af, Section as ak, SectionCollection as al, Shape as ao, ShapeCollection as ap, ShapeType as aq, Table as ar, TableCell as as, TableCellCollection as at, TableCollection as au, TableRow as av, TableRowCollection as aw, TrackedObjects as ax, UnderlineType as ay, VerticalAlignment as az, Body as b, Bookmark as e, BookmarkCollection as f, BreakType as g, ChangeTrackingMode as h, ClientObject as i, ClientResult as j, Comment as k, CommentCollection as l, CommentReply as m, CommentReplyCollection as n, ContentControl as o, ContentControlCollection as p, ContentControlType as s, Document as u, DocumentProperties as x };
|
|
2902
|
+
export type { NoteItemType as $, BesideLocation as B, CreateServerOptions as C, DocxEditorServerRuntime as D, DocxEditorErrorCode as F, DocxEditorErrorInit as G, DocxEditorRuntime as H, EditorModule as I, FieldTypeLiteral as M, HeaderFooterType as O, LoadOption as X, LoadQueryOptions as Y, CreateCollaborativeOptions as a, ParagraphAlignment as a3, ParagraphInsertTextLocation as a5, ParagraphReadingOrder as a6, RangeInsertTextLocation as a9, RevisionAuthorOptions as ad, RevisionAuthorSelection as ae, RevisionTextView as ag, RevisionType as ah, RunCallback as ai, SearchOptions as aj, SelectionMode as am, ServerPaginationOptions as an, BodyInsertParagraphLocation as c, BodyInsertTextLocation as d, ContentControlLockState as q, ContentControlSubtype as r, ContentControlValue as t, DocumentCapabilities as v, DocumentLimits as w, DocumentXmlLimits as y, DocumentZipLimits as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AutomationHandle, AutomationSpan, AutomationOperation, AutomationValue, AutomationSpanRef, RevisionBatchResult, AutomationHost, AutomationCapabilities, AutomationPaginationOptions } from '@docx-editor.dev/core/automation';
|
|
1
|
+
import { AutomationHandle, AutomationSpan, AutomationOperation, AutomationValue, AutomationSpanRef, RevisionBatchResult, RevisionAuthorResult, AutomationHost, AutomationCapabilities, AutomationPaginationOptions } from '@docx-editor.dev/core/automation';
|
|
2
2
|
import { CollaborationModuleContribution } from '@docx-editor.dev/core/collaboration';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -1352,7 +1352,25 @@ declare class Revision extends ModelObject implements PromisedItem {
|
|
|
1352
1352
|
/** @internal Plan the read this object's `load(...)` asked for. */
|
|
1353
1353
|
protected onLoad(request: ResolvedLoadOptions): void;
|
|
1354
1354
|
/** @internal Capture a batch target without exposing engine identity. */
|
|
1355
|
-
static batchHandle(revision: Revision, context: RequestContext): AutomationHandle;
|
|
1355
|
+
static batchHandle(revision: Revision, context: RequestContext, target?: string): AutomationHandle;
|
|
1356
|
+
}
|
|
1357
|
+
/**
|
|
1358
|
+
* Select every change these authors made, for {@link RevisionCollection.setAuthor}.
|
|
1359
|
+
* Matches `w:author` exactly.
|
|
1360
|
+
*
|
|
1361
|
+
* @public
|
|
1362
|
+
*/
|
|
1363
|
+
interface RevisionAuthorSelection {
|
|
1364
|
+
readonly authors: readonly string[];
|
|
1365
|
+
}
|
|
1366
|
+
/**
|
|
1367
|
+
* Options for {@link RevisionCollection.setAuthor}.
|
|
1368
|
+
*
|
|
1369
|
+
* @public
|
|
1370
|
+
*/
|
|
1371
|
+
interface RevisionAuthorOptions {
|
|
1372
|
+
/** The date to record. Omit it to keep each change's own date. */
|
|
1373
|
+
readonly date?: Date;
|
|
1356
1374
|
}
|
|
1357
1375
|
/**
|
|
1358
1376
|
* The tracked changes on a document, story or range, as of the batch that loaded them.
|
|
@@ -1395,6 +1413,23 @@ declare class RevisionCollection extends HandleCollection<Revision> {
|
|
|
1395
1413
|
* ```
|
|
1396
1414
|
*/
|
|
1397
1415
|
resolve(action: 'accept' | 'reject', revisions?: readonly Revision[]): ClientResult<RevisionBatchResult>;
|
|
1416
|
+
/**
|
|
1417
|
+
* Attribute changes in this story to another author. The changes stay pending.
|
|
1418
|
+
*
|
|
1419
|
+
* Pass revision objects to change those changes, or `{ authors }` to change every change
|
|
1420
|
+
* those authors made. Omit the selection to change every change in the story, by every
|
|
1421
|
+
* author, including structural ones absent from `items`. An empty array selects nothing.
|
|
1422
|
+
* Each change keeps its date unless you pass `options.date`. Keep this the only write in
|
|
1423
|
+
* its sync batch. Revision objects you pass stay valid and read the new author after a load.
|
|
1424
|
+
*
|
|
1425
|
+
* @example
|
|
1426
|
+
* ```ts
|
|
1427
|
+
* const result = context.document.revisions.setAuthor('Ada Lovelace', { authors: ['AI'] });
|
|
1428
|
+
* await context.sync();
|
|
1429
|
+
* console.log(result.value.updated.length, result.value.skipped);
|
|
1430
|
+
* ```
|
|
1431
|
+
*/
|
|
1432
|
+
setAuthor(author: string, selection?: readonly Revision[] | RevisionAuthorSelection, options?: RevisionAuthorOptions): ClientResult<RevisionAuthorResult>;
|
|
1398
1433
|
/** @internal The read that answers this collection's members. */
|
|
1399
1434
|
protected listing(): AutomationOperation;
|
|
1400
1435
|
/** @internal Build one member from an address the listing answered. */
|
|
@@ -1438,10 +1473,12 @@ interface SearchOptions {
|
|
|
1438
1473
|
* A range is a SNAPSHOT, not a tracked region. Its endpoints name the paragraphs they were found
|
|
1439
1474
|
* in and the offsets they were found at, so it stays meaningful across edits ELSEWHERE in the
|
|
1440
1475
|
* document and becomes an explicit `InvalidObjectPath` refusal once one of its paragraphs is
|
|
1441
|
-
* gone. What it deliberately does not do is follow edits INSIDE itself:
|
|
1442
|
-
*
|
|
1443
|
-
*
|
|
1444
|
-
*
|
|
1476
|
+
* gone. What it deliberately does not do is follow edits INSIDE itself: once its paragraph
|
|
1477
|
+
* gains a word at offset 0, a range over `"alpha"` fails with `StaleDocument` when used, rather
|
|
1478
|
+
* than reading or editing whatever now sits at offsets 0..5. Edits after the range, and formatting
|
|
1479
|
+
* changes, keep it valid. Word's own ranges do move, by keeping a live region in the document;
|
|
1480
|
+
* this API has none, and pretending otherwise would answer text from a place the caller was not
|
|
1481
|
+
* looking at.
|
|
1445
1482
|
*
|
|
1446
1483
|
* That is also why `start` and `end` are absent rather than unimplemented — they are
|
|
1447
1484
|
* document-wide character positions, a different addressing scheme from this API's paragraph
|
|
@@ -1516,7 +1553,15 @@ declare class Range extends ModelObject implements PromisedItem {
|
|
|
1516
1553
|
* gets back is a range naming the text that was written, in every case.
|
|
1517
1554
|
*/
|
|
1518
1555
|
insertText(text: string, insertLocation: InsertLocation | 'Replace' | 'Start' | 'End' | 'Before' | 'After'): Range;
|
|
1519
|
-
/**
|
|
1556
|
+
/**
|
|
1557
|
+
* Delete range content.
|
|
1558
|
+
*
|
|
1559
|
+
* With `TrackMineOnly`, text becomes deleted runs and each paragraph mark the range covers
|
|
1560
|
+
* becomes a deleted paragraph mark, also in collaboration. Marks that `Paragraph.delete()`
|
|
1561
|
+
* refuses to strike refuse here with the same codes. A tracked deletion or replacement that
|
|
1562
|
+
* starts a paragraph whose previous mark you already proposed deleting refuses with
|
|
1563
|
+
* `NotImplemented`.
|
|
1564
|
+
*/
|
|
1520
1565
|
delete(): void;
|
|
1521
1566
|
/** Clear this range's content, preserving the surrounding structure. */
|
|
1522
1567
|
clear(): void;
|
|
@@ -1553,7 +1598,11 @@ declare class Range extends ModelObject implements PromisedItem {
|
|
|
1553
1598
|
get inlinePictures(): InlinePictureCollection;
|
|
1554
1599
|
/** Insert a bounded PNG/JPEG image. Sync before configuring the returned picture. */
|
|
1555
1600
|
insertInlinePictureFromBase64(base64EncodedImage: string, insertLocation: InsertLocation | 'Before' | 'After' | 'Start' | 'End' | 'Replace'): InlinePicture;
|
|
1556
|
-
/**
|
|
1601
|
+
/**
|
|
1602
|
+
* Line, page, and next-page section breaks are supported; other break types refuse at sync.
|
|
1603
|
+
* TrackMineOnly records a line break as a tracked insertion. Page and section breaks refuse
|
|
1604
|
+
* while tracking.
|
|
1605
|
+
*/
|
|
1557
1606
|
insertBreak(breakType: BreakType | 'Page' | 'SectionNext' | 'Next' | 'Line' | 'SectionContinuous' | 'SectionEven' | 'SectionOdd', insertLocation: InsertLocation.before | InsertLocation.after | 'Before' | 'After'): void;
|
|
1558
1607
|
/**
|
|
1559
1608
|
* Insert a rectangular table before or after this range.
|
|
@@ -1582,6 +1631,12 @@ declare class Range extends ModelObject implements PromisedItem {
|
|
|
1582
1631
|
|
|
1583
1632
|
/** Paragraph alignment values readable and writable through this object model. */
|
|
1584
1633
|
type ParagraphAlignment = Alignment | 'Mixed' | 'Unknown' | 'Left' | 'Centered' | 'Right' | 'Justified';
|
|
1634
|
+
/**
|
|
1635
|
+
* A paragraph's base direction, as {@link Paragraph.readingOrder} reads and writes it.
|
|
1636
|
+
*
|
|
1637
|
+
* @public
|
|
1638
|
+
*/
|
|
1639
|
+
type ParagraphReadingOrder = 'LeftToRight' | 'RightToLeft';
|
|
1585
1640
|
/**
|
|
1586
1641
|
* One paragraph: what it says, what it is, and the ways it can be changed.
|
|
1587
1642
|
*
|
|
@@ -1641,6 +1696,21 @@ declare class Paragraph extends ModelObject implements PromisedItem {
|
|
|
1641
1696
|
*/
|
|
1642
1697
|
get alignment(): ParagraphAlignment;
|
|
1643
1698
|
set alignment(value: ParagraphAlignment);
|
|
1699
|
+
/**
|
|
1700
|
+
* The direction the paragraph reads in: `LeftToRight` or `RightToLeft`.
|
|
1701
|
+
*
|
|
1702
|
+
* A DocxEditor addition: Office.js has no paragraph direction member. The values follow
|
|
1703
|
+
* `Word.SectionDirection`. The read resolves the paragraph's own `w:bidi`, then its style, its
|
|
1704
|
+
* list level, an enclosing cell's table style, and the document defaults, as the page shows them.
|
|
1705
|
+
*
|
|
1706
|
+
* A write changes nothing when the paragraph already reads that way. Otherwise it removes the
|
|
1707
|
+
* paragraph's own direction when that alone set the other one, or states the asked direction,
|
|
1708
|
+
* which also overrides a style. The write keeps `alignment` as authored: in a right-to-left
|
|
1709
|
+
* paragraph, `Left` and `Right` name the start and end edges. With change tracking on, a write
|
|
1710
|
+
* that changes the direction is recorded as a paragraph formatting revision.
|
|
1711
|
+
*/
|
|
1712
|
+
get readingOrder(): ParagraphReadingOrder;
|
|
1713
|
+
set readingOrder(value: ParagraphReadingOrder);
|
|
1644
1714
|
/** Points. Negative for a hanging indent — the first line starting left of the rest. */
|
|
1645
1715
|
get firstLineIndent(): number;
|
|
1646
1716
|
set firstLineIndent(value: number);
|
|
@@ -1679,7 +1749,23 @@ declare class Paragraph extends ModelObject implements PromisedItem {
|
|
|
1679
1749
|
get listItem(): ListItem;
|
|
1680
1750
|
/** Empty this paragraph's text, leaving the paragraph itself where it is. */
|
|
1681
1751
|
clear(): void;
|
|
1682
|
-
/**
|
|
1752
|
+
/**
|
|
1753
|
+
* Remove this paragraph and everything in it.
|
|
1754
|
+
*
|
|
1755
|
+
* With `document.changeTrackingMode = 'TrackMineOnly'`, this records a tracked deletion of the
|
|
1756
|
+
* paragraph's text and its paragraph mark. Accepting it removes the paragraph; rejecting it
|
|
1757
|
+
* restores the paragraph.
|
|
1758
|
+
*
|
|
1759
|
+
* A tracked deletion refuses with `NotSupported` for the last paragraph of a story, table
|
|
1760
|
+
* cell, or content control; a paragraph directly before a table or block content control; a
|
|
1761
|
+
* paragraph whose mark ends a section; a paragraph with an inline content control; a
|
|
1762
|
+
* paragraph with a complex field boundary whose matching boundary is in another paragraph;
|
|
1763
|
+
* and a paragraph that nests inline content more than 64 levels deep. It refuses with
|
|
1764
|
+
* `NotImplemented` when the paragraph or the start of the next paragraph has a pending change,
|
|
1765
|
+
* including your own. Delete adjacent paragraphs in one sync:
|
|
1766
|
+
* a later sync beside your own pending deletion refuses, because the two would review as one
|
|
1767
|
+
* decision. A refusal refuses the whole sync.
|
|
1768
|
+
*/
|
|
1683
1769
|
delete(): void;
|
|
1684
1770
|
/** Write text over this paragraph or at either edge of it. Answers the written text's range. */
|
|
1685
1771
|
insertText(text: string, insertLocation: InsertLocation.replace | InsertLocation.start | InsertLocation.end | 'Replace' | 'Start' | 'End'): Range;
|
|
@@ -1907,11 +1993,12 @@ declare class PageSetup extends ModelObject {
|
|
|
1907
1993
|
* {@link Section.pageSetup}. The section itself is mostly navigation: the story it governs, the
|
|
1908
1994
|
* header and footer stories it declares, and the section after it.
|
|
1909
1995
|
*
|
|
1910
|
-
* `getHeader` and `getFooter` answer a body that may not exist yet
|
|
1911
|
-
*
|
|
1912
|
-
*
|
|
1913
|
-
*
|
|
1914
|
-
* exists only because it was asked about is a header the
|
|
1996
|
+
* `getHeader` and `getFooter` answer a body that may not exist yet. A section with no first-page
|
|
1997
|
+
* header inherits the previous section's. When no section declares one, the answer is an empty
|
|
1998
|
+
* body: every read on it answers as an empty story, and asking does not create the part. The
|
|
1999
|
+
* first text written into it creates the header or footer; asking alone would make a READ write
|
|
2000
|
+
* to the document, and a header that exists only because it was asked about is a header the
|
|
2001
|
+
* author never added.
|
|
1915
2002
|
*
|
|
1916
2003
|
* @public
|
|
1917
2004
|
*/
|
|
@@ -2444,7 +2531,11 @@ type DocxEditorErrorCode =
|
|
|
2444
2531
|
| 'InvalidRequestContext'
|
|
2445
2532
|
/** The runtime was disposed. Every later operation fails this way. */
|
|
2446
2533
|
| 'RuntimeDisposed'
|
|
2447
|
-
/**
|
|
2534
|
+
/**
|
|
2535
|
+
* The request was built from an older read, so nothing was applied: another writer moved the
|
|
2536
|
+
* document, or a range's text moved since the range was read, including by this context's own
|
|
2537
|
+
* earlier sync. Read again before retrying.
|
|
2538
|
+
*/
|
|
2448
2539
|
| 'StaleDocument'
|
|
2449
2540
|
/** The host is live but holds no document right now — an editor between mounts. */
|
|
2450
2541
|
| 'DocumentUnavailable'
|
|
@@ -2503,7 +2594,16 @@ declare class DocxEditorError extends Error {
|
|
|
2503
2594
|
readonly limit?: DocxEditorErrorInit['limit'];
|
|
2504
2595
|
/** Consumer-facing path of the object or property involved, when there is one to name. */
|
|
2505
2596
|
readonly target?: string;
|
|
2506
|
-
/**
|
|
2597
|
+
/**
|
|
2598
|
+
* For `StaleDocument`: the revision the context had last read at, when the refused batch
|
|
2599
|
+
* wrote. Absent for a batch that only read, on every host.
|
|
2600
|
+
*
|
|
2601
|
+
* When it equals {@link DocxEditorError.actualRevision}, the document is where this context
|
|
2602
|
+
* last saw it, and a range it holds is out of date: an edit after the range was read (often
|
|
2603
|
+
* this context's own earlier sync) moved its text. Search for the text again. When the two
|
|
2604
|
+
* differ, another writer changed the document after this context's last read. Read again
|
|
2605
|
+
* before you decide.
|
|
2606
|
+
*/
|
|
2507
2607
|
readonly expectedRevision?: number;
|
|
2508
2608
|
/** For `StaleDocument`: the revision the document was actually at. */
|
|
2509
2609
|
readonly actualRevision?: number;
|
|
@@ -2723,7 +2823,11 @@ interface DocumentZipLimits {
|
|
|
2723
2823
|
readonly maxEntries: number;
|
|
2724
2824
|
/** Most bytes the archive may decompress to in total. */
|
|
2725
2825
|
readonly maxTotalBytes: number;
|
|
2726
|
-
/**
|
|
2826
|
+
/**
|
|
2827
|
+
* Highest tolerated ratio of the archive's total uncompressed bytes to its own byte
|
|
2828
|
+
* length — the zip-bomb guard. Applies once the total exceeds 8 MiB, so a small
|
|
2829
|
+
* archive is never refused for compressing well.
|
|
2830
|
+
*/
|
|
2727
2831
|
readonly maxRatio?: number;
|
|
2728
2832
|
}
|
|
2729
2833
|
/** Resource limits for each parsed XML part. */
|
|
@@ -2794,5 +2898,5 @@ interface CreateServerOptions {
|
|
|
2794
2898
|
/** Options for {@link createCollaborative}. @public */
|
|
2795
2899
|
type CreateCollaborativeOptions = CreateServerOptions;
|
|
2796
2900
|
|
|
2797
|
-
export { Alignment as A, DocxEditorError as E, Field as J, FieldCollection as K, FieldType as L, Font as N, InlinePicture as P, InlinePictureCollection as Q, InsertLocation as R, List as S, ListBullet as T, ListCollection as U, ListItem as V, ListNumbering as W, NoteItem as Z, NoteItemCollection as _, PageOrientation as a0, PageSetup as a1, Paragraph as a2, ParagraphCollection as a4, Range as
|
|
2798
|
-
export type { NoteItemType as $, BesideLocation as B, CreateServerOptions as C, DocxEditorServerRuntime as D, DocxEditorErrorCode as F, DocxEditorErrorInit as G, DocxEditorRuntime as H, EditorModule as I, FieldTypeLiteral as M, HeaderFooterType as O, LoadOption as X, LoadQueryOptions as Y, CreateCollaborativeOptions as a, ParagraphAlignment as a3, ParagraphInsertTextLocation as a5, RangeInsertTextLocation as
|
|
2901
|
+
export { Alignment as A, DocxEditorError as E, Field as J, FieldCollection as K, FieldType as L, Font as N, InlinePicture as P, InlinePictureCollection as Q, InsertLocation as R, List as S, ListBullet as T, ListCollection as U, ListItem as V, ListNumbering as W, NoteItem as Z, NoteItemCollection as _, PageOrientation as a0, PageSetup as a1, Paragraph as a2, ParagraphCollection as a4, Range as a7, RangeCollection as a8, isDocxEditorError as aA, RemoveDocInfoType as aa, RequestContext as ab, Revision as ac, RevisionCollection as af, Section as ak, SectionCollection as al, Shape as ao, ShapeCollection as ap, ShapeType as aq, Table as ar, TableCell as as, TableCellCollection as at, TableCollection as au, TableRow as av, TableRowCollection as aw, TrackedObjects as ax, UnderlineType as ay, VerticalAlignment as az, Body as b, Bookmark as e, BookmarkCollection as f, BreakType as g, ChangeTrackingMode as h, ClientObject as i, ClientResult as j, Comment as k, CommentCollection as l, CommentReply as m, CommentReplyCollection as n, ContentControl as o, ContentControlCollection as p, ContentControlType as s, Document as u, DocumentProperties as x };
|
|
2902
|
+
export type { NoteItemType as $, BesideLocation as B, CreateServerOptions as C, DocxEditorServerRuntime as D, DocxEditorErrorCode as F, DocxEditorErrorInit as G, DocxEditorRuntime as H, EditorModule as I, FieldTypeLiteral as M, HeaderFooterType as O, LoadOption as X, LoadQueryOptions as Y, CreateCollaborativeOptions as a, ParagraphAlignment as a3, ParagraphInsertTextLocation as a5, ParagraphReadingOrder as a6, RangeInsertTextLocation as a9, RevisionAuthorOptions as ad, RevisionAuthorSelection as ae, RevisionTextView as ag, RevisionType as ah, RunCallback as ai, SearchOptions as aj, SelectionMode as am, ServerPaginationOptions as an, BodyInsertParagraphLocation as c, BodyInsertTextLocation as d, ContentControlLockState as q, ContentControlSubtype as r, ContentControlValue as t, DocumentCapabilities as v, DocumentLimits as w, DocumentXmlLimits as y, DocumentZipLimits as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docx-editor.dev/editor-api",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.28.0",
|
|
4
4
|
"description": "Document automation for DOCX: a batching object model that drives a document from a server or from an editor already open in a page",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"engines": {
|
|
@@ -83,6 +83,6 @@
|
|
|
83
83
|
"access": "public"
|
|
84
84
|
},
|
|
85
85
|
"peerDependencies": {
|
|
86
|
-
"@docx-editor.dev/core": "~2.
|
|
86
|
+
"@docx-editor.dev/core": "~2.28.0"
|
|
87
87
|
}
|
|
88
88
|
}
|