@docx-editor.dev/editor-api 2.25.0 → 2.27.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 +8 -0
- package/README.md +9 -5
- package/dist/browser.d.mts +2 -2
- package/dist/browser.d.ts +2 -2
- package/dist/browser.js +1 -1
- package/dist/browser.mjs +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{server-Csjpe214.d.mts → server-CK7TF4z-.d.mts} +143 -59
- package/dist/{server-Csjpe214.d.ts → server-CK7TF4z-.d.ts} +143 -59
- package/package.json +2 -2
|
@@ -1553,7 +1553,11 @@ declare class Range extends ModelObject implements PromisedItem {
|
|
|
1553
1553
|
get inlinePictures(): InlinePictureCollection;
|
|
1554
1554
|
/** Insert a bounded PNG/JPEG image. Sync before configuring the returned picture. */
|
|
1555
1555
|
insertInlinePictureFromBase64(base64EncodedImage: string, insertLocation: InsertLocation | 'Before' | 'After' | 'Start' | 'End' | 'Replace'): InlinePicture;
|
|
1556
|
-
/**
|
|
1556
|
+
/**
|
|
1557
|
+
* Line, page, and next-page section breaks are supported; other break types refuse at sync.
|
|
1558
|
+
* TrackMineOnly records a line break as a tracked insertion. Page and section breaks refuse
|
|
1559
|
+
* while tracking.
|
|
1560
|
+
*/
|
|
1557
1561
|
insertBreak(breakType: BreakType | 'Page' | 'SectionNext' | 'Next' | 'Line' | 'SectionContinuous' | 'SectionEven' | 'SectionOdd', insertLocation: InsertLocation.before | InsertLocation.after | 'Before' | 'After'): void;
|
|
1558
1562
|
/**
|
|
1559
1563
|
* Insert a rectangular table before or after this range.
|
|
@@ -1629,6 +1633,8 @@ declare class Paragraph extends ModelObject implements PromisedItem {
|
|
|
1629
1633
|
*/
|
|
1630
1634
|
get style(): string;
|
|
1631
1635
|
set style(value: string);
|
|
1636
|
+
/** Floating and inline shapes in this paragraph, such as text boxes and pictures. */
|
|
1637
|
+
get shapes(): ShapeCollection;
|
|
1632
1638
|
/** The character formatting of this paragraph's characters, and of its paragraph mark. */
|
|
1633
1639
|
get font(): Font;
|
|
1634
1640
|
/**
|
|
@@ -1780,6 +1786,80 @@ declare class RangeCollection extends ItemCollection<Range> {
|
|
|
1780
1786
|
protected promised(label: string, nullable: boolean): Range & PromisedItem;
|
|
1781
1787
|
}
|
|
1782
1788
|
|
|
1789
|
+
/** Which kind of note: Word's own two. */
|
|
1790
|
+
type NoteItemType = 'Footnote' | 'Endnote';
|
|
1791
|
+
/**
|
|
1792
|
+
* One footnote or endnote: text that belongs to the document but not to its flow.
|
|
1793
|
+
*
|
|
1794
|
+
* A note IS a story. Its {@link NoteItem.body} is an ordinary {@link Body} — paragraphs,
|
|
1795
|
+
* formatting, styles, the same operations — laid out at the foot of a page or the end of the
|
|
1796
|
+
* document rather than in the column, so everything the object model can do to the main story it
|
|
1797
|
+
* can do to a note without a second vocabulary.
|
|
1798
|
+
*
|
|
1799
|
+
* `delete()` removes the reference too. A note's body and the citation that reached it are one
|
|
1800
|
+
* thing to a reader, and deleting the body alone would leave a mark pointing at nothing. The
|
|
1801
|
+
* engine spells that as a package-level transaction, which is why it travels alone in its batch.
|
|
1802
|
+
*
|
|
1803
|
+
* @public
|
|
1804
|
+
*/
|
|
1805
|
+
declare class NoteItem extends ModelObject implements PromisedItem {
|
|
1806
|
+
#private;
|
|
1807
|
+
/** @internal A note a read has already named. */
|
|
1808
|
+
static at(context: RequestContext, label: string, address: ObjectAddress): NoteItem;
|
|
1809
|
+
/** @internal A note a queued read will name, or report as nothing. */
|
|
1810
|
+
static promised(context: RequestContext, label: string, nullable: boolean): NoteItem;
|
|
1811
|
+
private constructor();
|
|
1812
|
+
/** @internal Bind this object to the address the owning read answered. */
|
|
1813
|
+
hydrateAddress(address: ObjectAddress): void;
|
|
1814
|
+
/** @internal Settle as the null object: the read found nothing to name. */
|
|
1815
|
+
hydrateNull(): void;
|
|
1816
|
+
/** Whether this is a footnote or an endnote. */
|
|
1817
|
+
get type(): NoteItemType;
|
|
1818
|
+
/**
|
|
1819
|
+
* The note's plain text.
|
|
1820
|
+
*
|
|
1821
|
+
* This is the same value as loading `text` from {@link NoteItem.body}: every paragraph in the
|
|
1822
|
+
* note story, in reading order, joined by one carriage return per paragraph mark. Load it
|
|
1823
|
+
* directly when structured traversal or editing through {@link NoteItem.body} is not needed.
|
|
1824
|
+
*/
|
|
1825
|
+
get text(): string;
|
|
1826
|
+
/** The note's own story. */
|
|
1827
|
+
get body(): Body;
|
|
1828
|
+
/**
|
|
1829
|
+
* Remove the note and every reference to it.
|
|
1830
|
+
*
|
|
1831
|
+
* A package transaction, so it is the ONLY operation its `sync()` may carry — the host refuses it
|
|
1832
|
+
* any company rather than committing half a batch. Two syncs get a delete and anything else.
|
|
1833
|
+
*/
|
|
1834
|
+
delete(): void;
|
|
1835
|
+
/** The next note of the same kind. `ItemNotFound` at the sync when this is the last one. */
|
|
1836
|
+
getNext(): NoteItem;
|
|
1837
|
+
/** @internal Plan the read this object's `load(...)` asked for. */
|
|
1838
|
+
protected onLoad(request: ResolvedLoadOptions): void;
|
|
1839
|
+
}
|
|
1840
|
+
/**
|
|
1841
|
+
* The notes of one kind, in the order the notes part writes them.
|
|
1842
|
+
*
|
|
1843
|
+
* DocxEditor's own collection type: the pinned reference fixture does not carry
|
|
1844
|
+
* `Word.NoteItemCollection`, so it is not measured for conformance — recorded as an omission in
|
|
1845
|
+
* `compat/manifest.json` — while `NoteItem` itself is. Without it a note would be unreachable, which
|
|
1846
|
+
* is the one thing worse than an unmeasured collection.
|
|
1847
|
+
*/
|
|
1848
|
+
declare class NoteItemCollection extends HandleCollection<NoteItem> {
|
|
1849
|
+
#private;
|
|
1850
|
+
/** @internal A collection a named read will answer. */
|
|
1851
|
+
static of(context: RequestContext, label: string, owner: ObjectPath, plan: () => AutomationOperation): NoteItemCollection;
|
|
1852
|
+
private constructor();
|
|
1853
|
+
/** The first note. `ItemNotFound` at the sync if the document has none of this kind. */
|
|
1854
|
+
getFirst(): NoteItem;
|
|
1855
|
+
/** @internal The read that answers this collection's members. */
|
|
1856
|
+
protected listing(): AutomationOperation;
|
|
1857
|
+
/** @internal Build one member from an address the listing answered. */
|
|
1858
|
+
protected itemAt(label: string, address: ObjectAddress): NoteItem;
|
|
1859
|
+
/** @internal A member an edge accessor named before the sync that finds it. */
|
|
1860
|
+
protected promised(label: string, nullable: boolean): NoteItem & PromisedItem;
|
|
1861
|
+
}
|
|
1862
|
+
|
|
1783
1863
|
/** Which header or footer of a section: Word's own three variants. */
|
|
1784
1864
|
type HeaderFooterType = 'Primary' | 'FirstPage' | 'EvenPages';
|
|
1785
1865
|
/**
|
|
@@ -1831,11 +1911,12 @@ declare class PageSetup extends ModelObject {
|
|
|
1831
1911
|
* {@link Section.pageSetup}. The section itself is mostly navigation: the story it governs, the
|
|
1832
1912
|
* header and footer stories it declares, and the section after it.
|
|
1833
1913
|
*
|
|
1834
|
-
* `getHeader` and `getFooter` answer a body that may not exist yet
|
|
1835
|
-
*
|
|
1836
|
-
*
|
|
1837
|
-
*
|
|
1838
|
-
* exists only because it was asked about is a header the
|
|
1914
|
+
* `getHeader` and `getFooter` answer a body that may not exist yet. A section with no first-page
|
|
1915
|
+
* header inherits the previous section's. When no section declares one, the answer is an empty
|
|
1916
|
+
* body: every read on it answers as an empty story, and asking does not create the part. The
|
|
1917
|
+
* first text written into it creates the header or footer; asking alone would make a READ write
|
|
1918
|
+
* to the document, and a header that exists only because it was asked about is a header the
|
|
1919
|
+
* author never added.
|
|
1839
1920
|
*
|
|
1840
1921
|
* @public
|
|
1841
1922
|
*/
|
|
@@ -2442,78 +2523,75 @@ declare class DocxEditorError extends Error {
|
|
|
2442
2523
|
*/
|
|
2443
2524
|
declare function isDocxEditorError(value: unknown): value is DocxEditorError;
|
|
2444
2525
|
|
|
2445
|
-
/**
|
|
2446
|
-
|
|
2526
|
+
/** Word's shape types. Supported text-bearing shapes expose their own body. @public */
|
|
2527
|
+
declare enum ShapeType {
|
|
2528
|
+
unsupported = "Unsupported",
|
|
2529
|
+
textBox = "TextBox",
|
|
2530
|
+
geometricShape = "GeometricShape",
|
|
2531
|
+
group = "Group",
|
|
2532
|
+
picture = "Picture",
|
|
2533
|
+
canvas = "Canvas"
|
|
2534
|
+
}
|
|
2447
2535
|
/**
|
|
2448
|
-
* One
|
|
2536
|
+
* One floating or inline shape in a body or paragraph.
|
|
2449
2537
|
*
|
|
2450
|
-
*
|
|
2451
|
-
*
|
|
2452
|
-
* document rather than in the column, so everything the object model can do to the main story it
|
|
2453
|
-
* can do to a note without a second vocabulary.
|
|
2454
|
-
*
|
|
2455
|
-
* `delete()` removes the reference too. A note's body and the citation that reached it are one
|
|
2456
|
-
* thing to a reader, and deleting the body alone would leave a mark pointing at nothing. The
|
|
2457
|
-
* engine spells that as a package-level transaction, which is why it travels alone in its batch.
|
|
2538
|
+
* `id`, `name` and `type` are read-only. {@link Shape.body} exposes a supported shape's
|
|
2539
|
+
* own text story, including text-bearing geometric shapes. Other shapes refuse body access.
|
|
2458
2540
|
*
|
|
2459
2541
|
* @public
|
|
2460
2542
|
*/
|
|
2461
|
-
declare class
|
|
2543
|
+
declare class Shape extends ModelObject implements PromisedItem {
|
|
2462
2544
|
#private;
|
|
2463
|
-
/** @internal
|
|
2464
|
-
static at(context: RequestContext, label: string, address: ObjectAddress):
|
|
2465
|
-
/** @internal
|
|
2466
|
-
static promised(context: RequestContext, label: string, nullable: boolean):
|
|
2545
|
+
/** @internal */
|
|
2546
|
+
static at(context: RequestContext, label: string, address: ObjectAddress): Shape;
|
|
2547
|
+
/** @internal */
|
|
2548
|
+
static promised(context: RequestContext, label: string, nullable: boolean): Shape;
|
|
2467
2549
|
private constructor();
|
|
2468
|
-
/** @internal
|
|
2550
|
+
/** @internal */
|
|
2469
2551
|
hydrateAddress(address: ObjectAddress): void;
|
|
2470
|
-
/** @internal
|
|
2552
|
+
/** @internal */
|
|
2471
2553
|
hydrateNull(): void;
|
|
2472
|
-
/**
|
|
2473
|
-
get
|
|
2554
|
+
/** The shape's id in the document. */
|
|
2555
|
+
get id(): number;
|
|
2556
|
+
/** The shape's name in the document. */
|
|
2557
|
+
get name(): string;
|
|
2558
|
+
/** The shape's type. */
|
|
2559
|
+
get type(): ShapeType;
|
|
2474
2560
|
/**
|
|
2475
|
-
* The
|
|
2476
|
-
*
|
|
2477
|
-
*
|
|
2478
|
-
* note story, in reading order, joined by one carriage return per paragraph mark. Load it
|
|
2479
|
-
* directly when structured traversal or editing through {@link NoteItem.body} is not needed.
|
|
2561
|
+
* The shape's own text story in the main body, a header, or a footer.
|
|
2562
|
+
* Shapes in notes or nested text boxes refuse body access with `InvalidArgument` at the sync.
|
|
2563
|
+
* Shapes without their own supported text story also refuse access.
|
|
2480
2564
|
*/
|
|
2481
|
-
get text(): string;
|
|
2482
|
-
/** The note's own story. */
|
|
2483
2565
|
get body(): Body;
|
|
2484
|
-
/**
|
|
2485
|
-
* Remove the note and every reference to it.
|
|
2486
|
-
*
|
|
2487
|
-
* A package transaction, so it is the ONLY operation its `sync()` may carry — the host refuses it
|
|
2488
|
-
* any company rather than committing half a batch. Two syncs get a delete and anything else.
|
|
2489
|
-
*/
|
|
2490
|
-
delete(): void;
|
|
2491
|
-
/** The next note of the same kind. `ItemNotFound` at the sync when this is the last one. */
|
|
2492
|
-
getNext(): NoteItem;
|
|
2493
2566
|
/** @internal Plan the read this object's `load(...)` asked for. */
|
|
2494
2567
|
protected onLoad(request: ResolvedLoadOptions): void;
|
|
2495
2568
|
}
|
|
2496
2569
|
/**
|
|
2497
|
-
* The
|
|
2570
|
+
* The floating and inline shapes in a body or paragraph, in reading order.
|
|
2498
2571
|
*
|
|
2499
|
-
*
|
|
2500
|
-
* `Word.NoteItemCollection`, so it is not measured for conformance — recorded as an omission in
|
|
2501
|
-
* `compat/manifest.json` — while `NoteItem` itself is. Without it a note would be unreachable, which
|
|
2502
|
-
* is the one thing worse than an unmeasured collection.
|
|
2572
|
+
* @public
|
|
2503
2573
|
*/
|
|
2504
|
-
declare class
|
|
2574
|
+
declare class ShapeCollection extends ItemCollection<Shape> {
|
|
2505
2575
|
#private;
|
|
2506
|
-
/** @internal
|
|
2507
|
-
static of(context: RequestContext, label: string, owner: ObjectPath,
|
|
2576
|
+
/** @internal */
|
|
2577
|
+
static of(context: RequestContext, label: string, owner: ObjectPath, kind: SpanOwner, types?: readonly ShapeType[]): ShapeCollection;
|
|
2508
2578
|
private constructor();
|
|
2509
|
-
/** The first
|
|
2510
|
-
getFirst():
|
|
2511
|
-
/**
|
|
2579
|
+
/** The first shape. `ItemNotFound` at the sync when there is none. */
|
|
2580
|
+
getFirst(): Shape;
|
|
2581
|
+
/** The first shape, or a null object when there is none. */
|
|
2582
|
+
getFirstOrNullObject(): Shape;
|
|
2583
|
+
/** The shapes of the given types, in the same order. */
|
|
2584
|
+
getByTypes(types: ShapeType[]): ShapeCollection;
|
|
2585
|
+
/** @internal */
|
|
2512
2586
|
protected listing(): AutomationOperation;
|
|
2513
|
-
/** @internal
|
|
2514
|
-
protected
|
|
2515
|
-
/** @internal
|
|
2516
|
-
protected
|
|
2587
|
+
/** @internal */
|
|
2588
|
+
protected size(value: AutomationValue, label: string): number;
|
|
2589
|
+
/** @internal */
|
|
2590
|
+
protected addressAt(value: AutomationValue, label: string, index: number): ObjectAddress | undefined;
|
|
2591
|
+
/** @internal */
|
|
2592
|
+
protected itemAt(label: string, address: ObjectAddress): Shape;
|
|
2593
|
+
/** @internal */
|
|
2594
|
+
protected promised(label: string, nullable: boolean): Shape & PromisedItem;
|
|
2517
2595
|
}
|
|
2518
2596
|
|
|
2519
2597
|
/**
|
|
@@ -2624,6 +2702,8 @@ declare class Body extends ModelObject {
|
|
|
2624
2702
|
get fields(): FieldCollection;
|
|
2625
2703
|
/** Inline pictures within this body. */
|
|
2626
2704
|
get inlinePictures(): InlinePictureCollection;
|
|
2705
|
+
/** Floating and inline shapes in this body, such as text boxes and pictures. */
|
|
2706
|
+
get shapes(): ShapeCollection;
|
|
2627
2707
|
/** Top-level tables within this body or table cell. */
|
|
2628
2708
|
get tables(): TableCollection;
|
|
2629
2709
|
}
|
|
@@ -2648,7 +2728,11 @@ interface DocumentZipLimits {
|
|
|
2648
2728
|
readonly maxEntries: number;
|
|
2649
2729
|
/** Most bytes the archive may decompress to in total. */
|
|
2650
2730
|
readonly maxTotalBytes: number;
|
|
2651
|
-
/**
|
|
2731
|
+
/**
|
|
2732
|
+
* Highest tolerated ratio of the archive's total uncompressed bytes to its own byte
|
|
2733
|
+
* length — the zip-bomb guard. Applies once the total exceeds 8 MiB, so a small
|
|
2734
|
+
* archive is never refused for compressing well.
|
|
2735
|
+
*/
|
|
2652
2736
|
readonly maxRatio?: number;
|
|
2653
2737
|
}
|
|
2654
2738
|
/** Resource limits for each parsed XML part. */
|
|
@@ -2719,5 +2803,5 @@ interface CreateServerOptions {
|
|
|
2719
2803
|
/** Options for {@link createCollaborative}. @public */
|
|
2720
2804
|
type CreateCollaborativeOptions = CreateServerOptions;
|
|
2721
2805
|
|
|
2722
|
-
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 a6, RangeCollection as a7, RemoveDocInfoType as a9, RequestContext as aa, Revision as ab, RevisionCollection as ac, Section as ah, SectionCollection as ai,
|
|
2806
|
+
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 a6, RangeCollection as a7, RemoveDocInfoType as a9, RequestContext as aa, Revision as ab, RevisionCollection as ac, Section as ah, SectionCollection as ai, Shape as al, ShapeCollection as am, ShapeType as an, Table as ao, TableCell as ap, TableCellCollection as aq, TableCollection as ar, TableRow as as, TableRowCollection as at, TrackedObjects as au, UnderlineType as av, VerticalAlignment as aw, isDocxEditorError as ax, 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 };
|
|
2723
2807
|
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 a8, RevisionTextView as ad, RevisionType as ae, RunCallback as af, SearchOptions as ag, SelectionMode as aj, ServerPaginationOptions as ak, 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 };
|
|
@@ -1553,7 +1553,11 @@ declare class Range extends ModelObject implements PromisedItem {
|
|
|
1553
1553
|
get inlinePictures(): InlinePictureCollection;
|
|
1554
1554
|
/** Insert a bounded PNG/JPEG image. Sync before configuring the returned picture. */
|
|
1555
1555
|
insertInlinePictureFromBase64(base64EncodedImage: string, insertLocation: InsertLocation | 'Before' | 'After' | 'Start' | 'End' | 'Replace'): InlinePicture;
|
|
1556
|
-
/**
|
|
1556
|
+
/**
|
|
1557
|
+
* Line, page, and next-page section breaks are supported; other break types refuse at sync.
|
|
1558
|
+
* TrackMineOnly records a line break as a tracked insertion. Page and section breaks refuse
|
|
1559
|
+
* while tracking.
|
|
1560
|
+
*/
|
|
1557
1561
|
insertBreak(breakType: BreakType | 'Page' | 'SectionNext' | 'Next' | 'Line' | 'SectionContinuous' | 'SectionEven' | 'SectionOdd', insertLocation: InsertLocation.before | InsertLocation.after | 'Before' | 'After'): void;
|
|
1558
1562
|
/**
|
|
1559
1563
|
* Insert a rectangular table before or after this range.
|
|
@@ -1629,6 +1633,8 @@ declare class Paragraph extends ModelObject implements PromisedItem {
|
|
|
1629
1633
|
*/
|
|
1630
1634
|
get style(): string;
|
|
1631
1635
|
set style(value: string);
|
|
1636
|
+
/** Floating and inline shapes in this paragraph, such as text boxes and pictures. */
|
|
1637
|
+
get shapes(): ShapeCollection;
|
|
1632
1638
|
/** The character formatting of this paragraph's characters, and of its paragraph mark. */
|
|
1633
1639
|
get font(): Font;
|
|
1634
1640
|
/**
|
|
@@ -1780,6 +1786,80 @@ declare class RangeCollection extends ItemCollection<Range> {
|
|
|
1780
1786
|
protected promised(label: string, nullable: boolean): Range & PromisedItem;
|
|
1781
1787
|
}
|
|
1782
1788
|
|
|
1789
|
+
/** Which kind of note: Word's own two. */
|
|
1790
|
+
type NoteItemType = 'Footnote' | 'Endnote';
|
|
1791
|
+
/**
|
|
1792
|
+
* One footnote or endnote: text that belongs to the document but not to its flow.
|
|
1793
|
+
*
|
|
1794
|
+
* A note IS a story. Its {@link NoteItem.body} is an ordinary {@link Body} — paragraphs,
|
|
1795
|
+
* formatting, styles, the same operations — laid out at the foot of a page or the end of the
|
|
1796
|
+
* document rather than in the column, so everything the object model can do to the main story it
|
|
1797
|
+
* can do to a note without a second vocabulary.
|
|
1798
|
+
*
|
|
1799
|
+
* `delete()` removes the reference too. A note's body and the citation that reached it are one
|
|
1800
|
+
* thing to a reader, and deleting the body alone would leave a mark pointing at nothing. The
|
|
1801
|
+
* engine spells that as a package-level transaction, which is why it travels alone in its batch.
|
|
1802
|
+
*
|
|
1803
|
+
* @public
|
|
1804
|
+
*/
|
|
1805
|
+
declare class NoteItem extends ModelObject implements PromisedItem {
|
|
1806
|
+
#private;
|
|
1807
|
+
/** @internal A note a read has already named. */
|
|
1808
|
+
static at(context: RequestContext, label: string, address: ObjectAddress): NoteItem;
|
|
1809
|
+
/** @internal A note a queued read will name, or report as nothing. */
|
|
1810
|
+
static promised(context: RequestContext, label: string, nullable: boolean): NoteItem;
|
|
1811
|
+
private constructor();
|
|
1812
|
+
/** @internal Bind this object to the address the owning read answered. */
|
|
1813
|
+
hydrateAddress(address: ObjectAddress): void;
|
|
1814
|
+
/** @internal Settle as the null object: the read found nothing to name. */
|
|
1815
|
+
hydrateNull(): void;
|
|
1816
|
+
/** Whether this is a footnote or an endnote. */
|
|
1817
|
+
get type(): NoteItemType;
|
|
1818
|
+
/**
|
|
1819
|
+
* The note's plain text.
|
|
1820
|
+
*
|
|
1821
|
+
* This is the same value as loading `text` from {@link NoteItem.body}: every paragraph in the
|
|
1822
|
+
* note story, in reading order, joined by one carriage return per paragraph mark. Load it
|
|
1823
|
+
* directly when structured traversal or editing through {@link NoteItem.body} is not needed.
|
|
1824
|
+
*/
|
|
1825
|
+
get text(): string;
|
|
1826
|
+
/** The note's own story. */
|
|
1827
|
+
get body(): Body;
|
|
1828
|
+
/**
|
|
1829
|
+
* Remove the note and every reference to it.
|
|
1830
|
+
*
|
|
1831
|
+
* A package transaction, so it is the ONLY operation its `sync()` may carry — the host refuses it
|
|
1832
|
+
* any company rather than committing half a batch. Two syncs get a delete and anything else.
|
|
1833
|
+
*/
|
|
1834
|
+
delete(): void;
|
|
1835
|
+
/** The next note of the same kind. `ItemNotFound` at the sync when this is the last one. */
|
|
1836
|
+
getNext(): NoteItem;
|
|
1837
|
+
/** @internal Plan the read this object's `load(...)` asked for. */
|
|
1838
|
+
protected onLoad(request: ResolvedLoadOptions): void;
|
|
1839
|
+
}
|
|
1840
|
+
/**
|
|
1841
|
+
* The notes of one kind, in the order the notes part writes them.
|
|
1842
|
+
*
|
|
1843
|
+
* DocxEditor's own collection type: the pinned reference fixture does not carry
|
|
1844
|
+
* `Word.NoteItemCollection`, so it is not measured for conformance — recorded as an omission in
|
|
1845
|
+
* `compat/manifest.json` — while `NoteItem` itself is. Without it a note would be unreachable, which
|
|
1846
|
+
* is the one thing worse than an unmeasured collection.
|
|
1847
|
+
*/
|
|
1848
|
+
declare class NoteItemCollection extends HandleCollection<NoteItem> {
|
|
1849
|
+
#private;
|
|
1850
|
+
/** @internal A collection a named read will answer. */
|
|
1851
|
+
static of(context: RequestContext, label: string, owner: ObjectPath, plan: () => AutomationOperation): NoteItemCollection;
|
|
1852
|
+
private constructor();
|
|
1853
|
+
/** The first note. `ItemNotFound` at the sync if the document has none of this kind. */
|
|
1854
|
+
getFirst(): NoteItem;
|
|
1855
|
+
/** @internal The read that answers this collection's members. */
|
|
1856
|
+
protected listing(): AutomationOperation;
|
|
1857
|
+
/** @internal Build one member from an address the listing answered. */
|
|
1858
|
+
protected itemAt(label: string, address: ObjectAddress): NoteItem;
|
|
1859
|
+
/** @internal A member an edge accessor named before the sync that finds it. */
|
|
1860
|
+
protected promised(label: string, nullable: boolean): NoteItem & PromisedItem;
|
|
1861
|
+
}
|
|
1862
|
+
|
|
1783
1863
|
/** Which header or footer of a section: Word's own three variants. */
|
|
1784
1864
|
type HeaderFooterType = 'Primary' | 'FirstPage' | 'EvenPages';
|
|
1785
1865
|
/**
|
|
@@ -1831,11 +1911,12 @@ declare class PageSetup extends ModelObject {
|
|
|
1831
1911
|
* {@link Section.pageSetup}. The section itself is mostly navigation: the story it governs, the
|
|
1832
1912
|
* header and footer stories it declares, and the section after it.
|
|
1833
1913
|
*
|
|
1834
|
-
* `getHeader` and `getFooter` answer a body that may not exist yet
|
|
1835
|
-
*
|
|
1836
|
-
*
|
|
1837
|
-
*
|
|
1838
|
-
* exists only because it was asked about is a header the
|
|
1914
|
+
* `getHeader` and `getFooter` answer a body that may not exist yet. A section with no first-page
|
|
1915
|
+
* header inherits the previous section's. When no section declares one, the answer is an empty
|
|
1916
|
+
* body: every read on it answers as an empty story, and asking does not create the part. The
|
|
1917
|
+
* first text written into it creates the header or footer; asking alone would make a READ write
|
|
1918
|
+
* to the document, and a header that exists only because it was asked about is a header the
|
|
1919
|
+
* author never added.
|
|
1839
1920
|
*
|
|
1840
1921
|
* @public
|
|
1841
1922
|
*/
|
|
@@ -2442,78 +2523,75 @@ declare class DocxEditorError extends Error {
|
|
|
2442
2523
|
*/
|
|
2443
2524
|
declare function isDocxEditorError(value: unknown): value is DocxEditorError;
|
|
2444
2525
|
|
|
2445
|
-
/**
|
|
2446
|
-
|
|
2526
|
+
/** Word's shape types. Supported text-bearing shapes expose their own body. @public */
|
|
2527
|
+
declare enum ShapeType {
|
|
2528
|
+
unsupported = "Unsupported",
|
|
2529
|
+
textBox = "TextBox",
|
|
2530
|
+
geometricShape = "GeometricShape",
|
|
2531
|
+
group = "Group",
|
|
2532
|
+
picture = "Picture",
|
|
2533
|
+
canvas = "Canvas"
|
|
2534
|
+
}
|
|
2447
2535
|
/**
|
|
2448
|
-
* One
|
|
2536
|
+
* One floating or inline shape in a body or paragraph.
|
|
2449
2537
|
*
|
|
2450
|
-
*
|
|
2451
|
-
*
|
|
2452
|
-
* document rather than in the column, so everything the object model can do to the main story it
|
|
2453
|
-
* can do to a note without a second vocabulary.
|
|
2454
|
-
*
|
|
2455
|
-
* `delete()` removes the reference too. A note's body and the citation that reached it are one
|
|
2456
|
-
* thing to a reader, and deleting the body alone would leave a mark pointing at nothing. The
|
|
2457
|
-
* engine spells that as a package-level transaction, which is why it travels alone in its batch.
|
|
2538
|
+
* `id`, `name` and `type` are read-only. {@link Shape.body} exposes a supported shape's
|
|
2539
|
+
* own text story, including text-bearing geometric shapes. Other shapes refuse body access.
|
|
2458
2540
|
*
|
|
2459
2541
|
* @public
|
|
2460
2542
|
*/
|
|
2461
|
-
declare class
|
|
2543
|
+
declare class Shape extends ModelObject implements PromisedItem {
|
|
2462
2544
|
#private;
|
|
2463
|
-
/** @internal
|
|
2464
|
-
static at(context: RequestContext, label: string, address: ObjectAddress):
|
|
2465
|
-
/** @internal
|
|
2466
|
-
static promised(context: RequestContext, label: string, nullable: boolean):
|
|
2545
|
+
/** @internal */
|
|
2546
|
+
static at(context: RequestContext, label: string, address: ObjectAddress): Shape;
|
|
2547
|
+
/** @internal */
|
|
2548
|
+
static promised(context: RequestContext, label: string, nullable: boolean): Shape;
|
|
2467
2549
|
private constructor();
|
|
2468
|
-
/** @internal
|
|
2550
|
+
/** @internal */
|
|
2469
2551
|
hydrateAddress(address: ObjectAddress): void;
|
|
2470
|
-
/** @internal
|
|
2552
|
+
/** @internal */
|
|
2471
2553
|
hydrateNull(): void;
|
|
2472
|
-
/**
|
|
2473
|
-
get
|
|
2554
|
+
/** The shape's id in the document. */
|
|
2555
|
+
get id(): number;
|
|
2556
|
+
/** The shape's name in the document. */
|
|
2557
|
+
get name(): string;
|
|
2558
|
+
/** The shape's type. */
|
|
2559
|
+
get type(): ShapeType;
|
|
2474
2560
|
/**
|
|
2475
|
-
* The
|
|
2476
|
-
*
|
|
2477
|
-
*
|
|
2478
|
-
* note story, in reading order, joined by one carriage return per paragraph mark. Load it
|
|
2479
|
-
* directly when structured traversal or editing through {@link NoteItem.body} is not needed.
|
|
2561
|
+
* The shape's own text story in the main body, a header, or a footer.
|
|
2562
|
+
* Shapes in notes or nested text boxes refuse body access with `InvalidArgument` at the sync.
|
|
2563
|
+
* Shapes without their own supported text story also refuse access.
|
|
2480
2564
|
*/
|
|
2481
|
-
get text(): string;
|
|
2482
|
-
/** The note's own story. */
|
|
2483
2565
|
get body(): Body;
|
|
2484
|
-
/**
|
|
2485
|
-
* Remove the note and every reference to it.
|
|
2486
|
-
*
|
|
2487
|
-
* A package transaction, so it is the ONLY operation its `sync()` may carry — the host refuses it
|
|
2488
|
-
* any company rather than committing half a batch. Two syncs get a delete and anything else.
|
|
2489
|
-
*/
|
|
2490
|
-
delete(): void;
|
|
2491
|
-
/** The next note of the same kind. `ItemNotFound` at the sync when this is the last one. */
|
|
2492
|
-
getNext(): NoteItem;
|
|
2493
2566
|
/** @internal Plan the read this object's `load(...)` asked for. */
|
|
2494
2567
|
protected onLoad(request: ResolvedLoadOptions): void;
|
|
2495
2568
|
}
|
|
2496
2569
|
/**
|
|
2497
|
-
* The
|
|
2570
|
+
* The floating and inline shapes in a body or paragraph, in reading order.
|
|
2498
2571
|
*
|
|
2499
|
-
*
|
|
2500
|
-
* `Word.NoteItemCollection`, so it is not measured for conformance — recorded as an omission in
|
|
2501
|
-
* `compat/manifest.json` — while `NoteItem` itself is. Without it a note would be unreachable, which
|
|
2502
|
-
* is the one thing worse than an unmeasured collection.
|
|
2572
|
+
* @public
|
|
2503
2573
|
*/
|
|
2504
|
-
declare class
|
|
2574
|
+
declare class ShapeCollection extends ItemCollection<Shape> {
|
|
2505
2575
|
#private;
|
|
2506
|
-
/** @internal
|
|
2507
|
-
static of(context: RequestContext, label: string, owner: ObjectPath,
|
|
2576
|
+
/** @internal */
|
|
2577
|
+
static of(context: RequestContext, label: string, owner: ObjectPath, kind: SpanOwner, types?: readonly ShapeType[]): ShapeCollection;
|
|
2508
2578
|
private constructor();
|
|
2509
|
-
/** The first
|
|
2510
|
-
getFirst():
|
|
2511
|
-
/**
|
|
2579
|
+
/** The first shape. `ItemNotFound` at the sync when there is none. */
|
|
2580
|
+
getFirst(): Shape;
|
|
2581
|
+
/** The first shape, or a null object when there is none. */
|
|
2582
|
+
getFirstOrNullObject(): Shape;
|
|
2583
|
+
/** The shapes of the given types, in the same order. */
|
|
2584
|
+
getByTypes(types: ShapeType[]): ShapeCollection;
|
|
2585
|
+
/** @internal */
|
|
2512
2586
|
protected listing(): AutomationOperation;
|
|
2513
|
-
/** @internal
|
|
2514
|
-
protected
|
|
2515
|
-
/** @internal
|
|
2516
|
-
protected
|
|
2587
|
+
/** @internal */
|
|
2588
|
+
protected size(value: AutomationValue, label: string): number;
|
|
2589
|
+
/** @internal */
|
|
2590
|
+
protected addressAt(value: AutomationValue, label: string, index: number): ObjectAddress | undefined;
|
|
2591
|
+
/** @internal */
|
|
2592
|
+
protected itemAt(label: string, address: ObjectAddress): Shape;
|
|
2593
|
+
/** @internal */
|
|
2594
|
+
protected promised(label: string, nullable: boolean): Shape & PromisedItem;
|
|
2517
2595
|
}
|
|
2518
2596
|
|
|
2519
2597
|
/**
|
|
@@ -2624,6 +2702,8 @@ declare class Body extends ModelObject {
|
|
|
2624
2702
|
get fields(): FieldCollection;
|
|
2625
2703
|
/** Inline pictures within this body. */
|
|
2626
2704
|
get inlinePictures(): InlinePictureCollection;
|
|
2705
|
+
/** Floating and inline shapes in this body, such as text boxes and pictures. */
|
|
2706
|
+
get shapes(): ShapeCollection;
|
|
2627
2707
|
/** Top-level tables within this body or table cell. */
|
|
2628
2708
|
get tables(): TableCollection;
|
|
2629
2709
|
}
|
|
@@ -2648,7 +2728,11 @@ interface DocumentZipLimits {
|
|
|
2648
2728
|
readonly maxEntries: number;
|
|
2649
2729
|
/** Most bytes the archive may decompress to in total. */
|
|
2650
2730
|
readonly maxTotalBytes: number;
|
|
2651
|
-
/**
|
|
2731
|
+
/**
|
|
2732
|
+
* Highest tolerated ratio of the archive's total uncompressed bytes to its own byte
|
|
2733
|
+
* length — the zip-bomb guard. Applies once the total exceeds 8 MiB, so a small
|
|
2734
|
+
* archive is never refused for compressing well.
|
|
2735
|
+
*/
|
|
2652
2736
|
readonly maxRatio?: number;
|
|
2653
2737
|
}
|
|
2654
2738
|
/** Resource limits for each parsed XML part. */
|
|
@@ -2719,5 +2803,5 @@ interface CreateServerOptions {
|
|
|
2719
2803
|
/** Options for {@link createCollaborative}. @public */
|
|
2720
2804
|
type CreateCollaborativeOptions = CreateServerOptions;
|
|
2721
2805
|
|
|
2722
|
-
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 a6, RangeCollection as a7, RemoveDocInfoType as a9, RequestContext as aa, Revision as ab, RevisionCollection as ac, Section as ah, SectionCollection as ai,
|
|
2806
|
+
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 a6, RangeCollection as a7, RemoveDocInfoType as a9, RequestContext as aa, Revision as ab, RevisionCollection as ac, Section as ah, SectionCollection as ai, Shape as al, ShapeCollection as am, ShapeType as an, Table as ao, TableCell as ap, TableCellCollection as aq, TableCollection as ar, TableRow as as, TableRowCollection as at, TrackedObjects as au, UnderlineType as av, VerticalAlignment as aw, isDocxEditorError as ax, 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 };
|
|
2723
2807
|
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 a8, RevisionTextView as ad, RevisionType as ae, RunCallback as af, SearchOptions as ag, SelectionMode as aj, ServerPaginationOptions as ak, 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.27.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.27.0"
|
|
87
87
|
}
|
|
88
88
|
}
|