@docx-editor.dev/editor-api 2.27.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.
@@ -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: a range over `"alpha"`
1442
- * whose paragraph then gains a word at offset 0 still names offsets 0..5. Word's own ranges do
1443
- * move, by keeping a live region in the document; this API has none, and pretending otherwise
1444
- * would answer text from a place the caller was not looking at.
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
- /** Delete range content. Tracking supports adjacent sibling paragraphs outside collaboration. */
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;
@@ -1586,6 +1631,12 @@ declare class Range extends ModelObject implements PromisedItem {
1586
1631
 
1587
1632
  /** Paragraph alignment values readable and writable through this object model. */
1588
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';
1589
1640
  /**
1590
1641
  * One paragraph: what it says, what it is, and the ways it can be changed.
1591
1642
  *
@@ -1645,6 +1696,21 @@ declare class Paragraph extends ModelObject implements PromisedItem {
1645
1696
  */
1646
1697
  get alignment(): ParagraphAlignment;
1647
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);
1648
1714
  /** Points. Negative for a hanging indent — the first line starting left of the rest. */
1649
1715
  get firstLineIndent(): number;
1650
1716
  set firstLineIndent(value: number);
@@ -1683,7 +1749,23 @@ declare class Paragraph extends ModelObject implements PromisedItem {
1683
1749
  get listItem(): ListItem;
1684
1750
  /** Empty this paragraph's text, leaving the paragraph itself where it is. */
1685
1751
  clear(): void;
1686
- /** Remove this paragraph and everything in it. */
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
+ */
1687
1769
  delete(): void;
1688
1770
  /** Write text over this paragraph or at either edge of it. Answers the written text's range. */
1689
1771
  insertText(text: string, insertLocation: InsertLocation.replace | InsertLocation.start | InsertLocation.end | 'Replace' | 'Start' | 'End'): Range;
@@ -2449,7 +2531,11 @@ type DocxEditorErrorCode =
2449
2531
  | 'InvalidRequestContext'
2450
2532
  /** The runtime was disposed. Every later operation fails this way. */
2451
2533
  | 'RuntimeDisposed'
2452
- /** The document moved under a context that had already read from it; nothing was applied. */
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
+ */
2453
2539
  | 'StaleDocument'
2454
2540
  /** The host is live but holds no document right now — an editor between mounts. */
2455
2541
  | 'DocumentUnavailable'
@@ -2508,7 +2594,16 @@ declare class DocxEditorError extends Error {
2508
2594
  readonly limit?: DocxEditorErrorInit['limit'];
2509
2595
  /** Consumer-facing path of the object or property involved, when there is one to name. */
2510
2596
  readonly target?: string;
2511
- /** For `StaleDocument`: the revision the context had read at. */
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
+ */
2512
2607
  readonly expectedRevision?: number;
2513
2608
  /** For `StaleDocument`: the revision the document was actually at. */
2514
2609
  readonly actualRevision?: number;
@@ -2803,5 +2898,5 @@ interface CreateServerOptions {
2803
2898
  /** Options for {@link createCollaborative}. @public */
2804
2899
  type CreateCollaborativeOptions = CreateServerOptions;
2805
2900
 
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 };
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 };
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: a range over `"alpha"`
1442
- * whose paragraph then gains a word at offset 0 still names offsets 0..5. Word's own ranges do
1443
- * move, by keeping a live region in the document; this API has none, and pretending otherwise
1444
- * would answer text from a place the caller was not looking at.
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
- /** Delete range content. Tracking supports adjacent sibling paragraphs outside collaboration. */
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;
@@ -1586,6 +1631,12 @@ declare class Range extends ModelObject implements PromisedItem {
1586
1631
 
1587
1632
  /** Paragraph alignment values readable and writable through this object model. */
1588
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';
1589
1640
  /**
1590
1641
  * One paragraph: what it says, what it is, and the ways it can be changed.
1591
1642
  *
@@ -1645,6 +1696,21 @@ declare class Paragraph extends ModelObject implements PromisedItem {
1645
1696
  */
1646
1697
  get alignment(): ParagraphAlignment;
1647
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);
1648
1714
  /** Points. Negative for a hanging indent — the first line starting left of the rest. */
1649
1715
  get firstLineIndent(): number;
1650
1716
  set firstLineIndent(value: number);
@@ -1683,7 +1749,23 @@ declare class Paragraph extends ModelObject implements PromisedItem {
1683
1749
  get listItem(): ListItem;
1684
1750
  /** Empty this paragraph's text, leaving the paragraph itself where it is. */
1685
1751
  clear(): void;
1686
- /** Remove this paragraph and everything in it. */
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
+ */
1687
1769
  delete(): void;
1688
1770
  /** Write text over this paragraph or at either edge of it. Answers the written text's range. */
1689
1771
  insertText(text: string, insertLocation: InsertLocation.replace | InsertLocation.start | InsertLocation.end | 'Replace' | 'Start' | 'End'): Range;
@@ -2449,7 +2531,11 @@ type DocxEditorErrorCode =
2449
2531
  | 'InvalidRequestContext'
2450
2532
  /** The runtime was disposed. Every later operation fails this way. */
2451
2533
  | 'RuntimeDisposed'
2452
- /** The document moved under a context that had already read from it; nothing was applied. */
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
+ */
2453
2539
  | 'StaleDocument'
2454
2540
  /** The host is live but holds no document right now — an editor between mounts. */
2455
2541
  | 'DocumentUnavailable'
@@ -2508,7 +2594,16 @@ declare class DocxEditorError extends Error {
2508
2594
  readonly limit?: DocxEditorErrorInit['limit'];
2509
2595
  /** Consumer-facing path of the object or property involved, when there is one to name. */
2510
2596
  readonly target?: string;
2511
- /** For `StaleDocument`: the revision the context had read at. */
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
+ */
2512
2607
  readonly expectedRevision?: number;
2513
2608
  /** For `StaleDocument`: the revision the document was actually at. */
2514
2609
  readonly actualRevision?: number;
@@ -2803,5 +2898,5 @@ interface CreateServerOptions {
2803
2898
  /** Options for {@link createCollaborative}. @public */
2804
2899
  type CreateCollaborativeOptions = CreateServerOptions;
2805
2900
 
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 };
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 };
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.27.0",
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.27.0"
86
+ "@docx-editor.dev/core": "~2.28.0"
87
87
  }
88
88
  }