@docx-editor.dev/editor-api 2.21.0 → 2.22.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.
@@ -98,26 +98,26 @@ If model generation happens inside a run, commit against the revision that run r
98
98
 
99
99
  Use `isDocxEditorError(error)` and branch on `error.code`. `error.target` identifies the failing public member. Do not parse message strings. A failed sync does not apply its queued document edits or tracking-mode changes. Earlier successful syncs remain committed. Failed batches are discarded and are never automatically replayed.
100
100
 
101
- | Code | Next action |
102
- | -------------------- | ------------------------------------------------------------------------------------------------------------------- |
103
- | `PropertyNotLoaded` | Load the named property and await sync before reading it. |
104
- | `InvalidObjectPath` | Sync before using a newly returned proxy, or acquire a fresh proxy in a new run. |
105
- | `StaleDocument` | Re-read, re-anchor, and reconsider the model proposal. |
106
- | `ConflictingChanges` | Separate edits that claim the same paragraph and reconsider anchors between commits. |
107
- | `NotSupported` | Check the host, tracking mode, author, and operation against the subset below. |
108
- | `NotImplemented` | Check the documented subset, including pending-revision boundaries. Reconsider the target; do not disable tracking. |
109
- | `InvalidArgument` | Validate the argument and consult the member's JSDoc. |
101
+ | Code | Next action |
102
+ | --- | --- |
103
+ | `PropertyNotLoaded` | Load the named property and await sync before reading it. |
104
+ | `InvalidObjectPath` | Sync before using a newly returned proxy, or acquire a fresh proxy in a new run. |
105
+ | `StaleDocument` | Re-read, re-anchor, and reconsider the model proposal. |
106
+ | `ConflictingChanges` | Separate edits that claim the same paragraph and reconsider anchors between commits. |
107
+ | `NotSupported` | Check the host, tracking mode, author, and operation against the [tracking subset](#tracking-subset). |
108
+ | `NotImplemented` | Check the documented subset, including pending-revision boundaries. Reconsider the target; do not disable tracking. |
109
+ | `InvalidArgument` | Validate the argument and consult the member's JSDoc. |
110
110
 
111
111
  ## Tracking subset
112
112
 
113
- | Intent | Office.js-compatible API |
114
- | ---------------------------------- | ---------------------------------------------------------------------- |
115
- | Track this agent's text edits | `context.document.changeTrackingMode = 'TrackMineOnly'` |
116
- | Insert before or after a range | `range.insertText(text, 'Before')` or `'After'` |
117
- | Replace a range | `range.insertText(text, 'Replace')` |
118
- | Delete range content | `range.delete()` or `range.clear()` |
119
- | Read the current mode | `document.load('changeTrackingMode')`, then sync and read the property |
120
- | Make an intentional permanent edit | Explicitly set `changeTrackingMode = 'Off'` |
113
+ | Intent | Office.js-compatible API |
114
+ | --- | --- |
115
+ | Track this agent's text edits | `context.document.changeTrackingMode = 'TrackMineOnly'` |
116
+ | Insert before or after a range | `range.insertText(text, 'Before')` or `'After'` |
117
+ | Replace a range | `range.insertText(text, 'Replace')` |
118
+ | Delete range content | `range.delete()` or `range.clear()` |
119
+ | Read the current mode | `document.load('changeTrackingMode')`, then sync and read the property |
120
+ | Make an intentional permanent edit | Explicitly set `changeTrackingMode = 'Off'` |
121
121
 
122
122
  `Off` is the initial runtime mode. Browser tracked writes require the review module; this property does not change the editor UI mode. `TrackMineOnly` needs a configured author and persists for that host session. It does not change peers' editing modes or persist a document-wide policy. `TrackAll` fails with `NotSupported`. Browser UI modes remain controlled by the editor host. Tracked edits support inline text in one paragraph, including table cells. The runtime rejects targets that touch pending revisions. The runtime rejects tracked deletion or replacement of simple fields containing nested fields or other result containers. Direct result runs remain supported. The runtime rejects structural and formatting edits while tracking changes. Comments and revision decisions remain available. Never silently fall back to `Off` when an edit cannot be tracked.
123
123
 
package/README.md CHANGED
@@ -7,14 +7,14 @@
7
7
  <p align="center">
8
8
  <a href="https://www.npmjs.com/package/@docx-editor.dev/editor-api"><img src="https://img.shields.io/npm/v/@docx-editor.dev/editor-api.svg?style=flat-square&color=3B5BDB" alt="npm version" /></a>
9
9
  <a href="https://www.npmjs.com/package/@docx-editor.dev/editor-api"><img src="https://img.shields.io/npm/dm/@docx-editor.dev/editor-api.svg?style=flat-square&color=3B5BDB" alt="npm downloads" /></a>
10
- <a href="https://github.com/eigenpal/docx-editor/blob/main/packages/editor-api/LICENSE.md"><img src="https://img.shields.io/badge/license-EigenPal_Pro_Evaluation_1.0-blue.svg?style=flat-square&color=3B5BDB" alt="license" /></a>
10
+ <a href="https://github.com/eigenpal/docx-editor/blob/main/packages/editor-api/LICENSE.md"><img src="https://img.shields.io/badge/license-EigenPal_Pro_License-blue.svg?style=flat-square&color=3B5BDB" alt="EigenPal Pro License" /></a>
11
11
  <a href="https://docx-editor.dev/editor"><img src="https://img.shields.io/badge/Live_Demo-3B5BDB?style=flat-square&logo=vercel&logoColor=white" alt="Demo" /></a>
12
12
  <a href="https://www.docx-editor.dev/docs"><img src="https://img.shields.io/badge/Docs-3B5BDB?style=flat-square&logo=readthedocs&logoColor=white" alt="Documentation" /></a>
13
13
  </p>
14
14
 
15
15
  # @docx-editor.dev/editor-api
16
16
 
17
- `@docx-editor.dev/editor-api` edits DOCX files through a supported subset of Word's JavaScript object model, including paragraphs, ranges, comments, and revisions. Use `load()` to queue reads and `sync()` to apply each batch atomically.
17
+ Edit DOCX files through a supported subset of Word's JavaScript object model. The API includes paragraphs, ranges, comments, and revisions. Use `load()` to queue reads and `sync()` to apply each batch atomically.
18
18
 
19
19
  Run the API on a server over DOCX bytes or in the browser against an open editor. See [Office.js compatibility](https://www.docx-editor.dev/docs/2.x/editor-api/office-js-api) for supported members and differences from Word.
20
20
 
@@ -28,20 +28,20 @@ Server use requires Node.js `^20.16.0 || >=22.3.0`.
28
28
 
29
29
  Start with [Runtime and setup](https://www.docx-editor.dev/docs/2.x/editor-api/runtime) and [Batching, loading, and errors](https://www.docx-editor.dev/docs/2.x/editor-api/batching-and-errors).
30
30
 
31
- | Task | Guide |
32
- | --------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
33
- | Read, insert, replace, or remove text | [Text and ranges](https://www.docx-editor.dev/docs/2.x/editor-api/text-and-ranges) |
34
- | Find matches, split paragraphs, or use bookmarks | [Search and navigation](https://www.docx-editor.dev/docs/2.x/editor-api/search-and-navigation) |
35
- | Set fonts, paragraph properties, styles, or links | [Formatting and styles](https://www.docx-editor.dev/docs/2.x/editor-api/formatting) |
36
- | Create and configure lists | [Lists and numbering](https://www.docx-editor.dev/docs/2.x/editor-api/lists) |
37
- | Work with table values, rows, columns, and cells | [Tables and cells](https://www.docx-editor.dev/docs/2.x/editor-api/tables) |
38
- | Insert and resize images | [Inline pictures](https://www.docx-editor.dev/docs/2.x/editor-api/pictures) |
39
- | Calculate PAGE and NUMPAGES | [Fields and pagination](https://www.docx-editor.dev/docs/2.x/editor-api/fields) |
40
- | Set page geometry and edit headers, footers, or notes | [Page layout and stories](https://www.docx-editor.dev/docs/2.x/editor-api/page-layout-and-stories) |
41
- | Fill template controls and edit their metadata | [Content controls](https://www.docx-editor.dev/docs/2.x/editor-api/content-controls) |
42
- | Discuss content and manage threads | [Comments](https://www.docx-editor.dev/docs/2.x/editor-api/comments) |
43
- | Create, inspect, accept, or reject tracked changes | [Tracked changes](https://www.docx-editor.dev/docs/2.x/editor-api/revisions) |
44
- | Find any public object, method, property, or support type | [API member directory](https://www.docx-editor.dev/docs/2.x/editor-api/reference) |
31
+ | Task | Guide |
32
+ | --- | --- |
33
+ | Read, insert, replace, or remove text | [Text and ranges](https://www.docx-editor.dev/docs/2.x/editor-api/text-and-ranges) |
34
+ | Find matches, split paragraphs, or use bookmarks | [Search and navigation](https://www.docx-editor.dev/docs/2.x/editor-api/search-and-navigation) |
35
+ | Set fonts, paragraph properties, styles, or links | [Formatting and styles](https://www.docx-editor.dev/docs/2.x/editor-api/formatting) |
36
+ | Create and configure lists | [Lists and numbering](https://www.docx-editor.dev/docs/2.x/editor-api/lists) |
37
+ | Work with table values, rows, columns, and cells | [Tables and cells](https://www.docx-editor.dev/docs/2.x/editor-api/tables) |
38
+ | Insert and resize images | [Inline pictures](https://www.docx-editor.dev/docs/2.x/editor-api/pictures) |
39
+ | Calculate PAGE and NUMPAGES | [Fields and pagination](https://www.docx-editor.dev/docs/2.x/editor-api/fields) |
40
+ | Set page geometry and edit headers, footers, or notes | [Page layout and stories](https://www.docx-editor.dev/docs/2.x/editor-api/page-layout-and-stories) |
41
+ | Fill template controls and edit their metadata | [Content controls](https://www.docx-editor.dev/docs/2.x/editor-api/content-controls) |
42
+ | Discuss content and manage threads | [Comments](https://www.docx-editor.dev/docs/2.x/editor-api/comments) |
43
+ | Create, inspect, accept, or reject tracked changes | [Tracked changes](https://www.docx-editor.dev/docs/2.x/editor-api/revisions) |
44
+ | Find any public object, method, property, or support type | [API member directory](https://www.docx-editor.dev/docs/2.x/editor-api/reference) |
45
45
 
46
46
  ## On a server
47
47
 
@@ -61,7 +61,7 @@ try {
61
61
  await context.sync(); // Read the matching ranges.
62
62
 
63
63
  for (const match of matches.items) match.insertText('$500k', 'Replace');
64
- await context.sync(); // one atomic batch: all of the writes, or none
64
+ await context.sync(); // Commit all writes in one atomic batch.
65
65
  return matches.items.length;
66
66
  });
67
67
  console.log(`replaced ${filled}`);
@@ -71,7 +71,7 @@ try {
71
71
  }
72
72
  ```
73
73
 
74
- `createServer` finishes its bounded parse before its promise resolves and does not retain the input `Uint8Array`; you may reuse or transfer that buffer afterward. Every `save()` returns a fresh, caller-owned `Uint8Array`, so transferring or mutating one result does not affect the runtime or a later save. Detached edits remain detached until your application explicitly loads the returned bytes into a live editor.
74
+ `createServer` parses the document before resolving and does not retain the input buffer. You can then reuse or transfer that buffer. Each `save()` returns an independent `Uint8Array`. Load the saved bytes into a live editor to display server edits.
75
75
 
76
76
  ## Create tracked changes on a server
77
77
 
@@ -157,13 +157,13 @@ To upgrade from the former reviewer, bridge, MCP, or chat APIs, see [Migration](
157
157
 
158
158
  ## Packages
159
159
 
160
- | Package | Description |
161
- | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------- |
162
- | [`@docx-editor.dev/react`](https://www.npmjs.com/package/@docx-editor.dev/react) | React adapter. `<DocxEditor>`, provider primitives, hooks, and compound chrome. |
163
- | [`@docx-editor.dev/core`](https://www.npmjs.com/package/@docx-editor.dev/core) | Framework-agnostic engine: OOXML read/write, canonical document tree, layout, paint. |
164
- | [`@docx-editor.dev/i18n`](https://www.npmjs.com/package/@docx-editor.dev/i18n) | Shared locale strings and types. |
165
- | [`@docx-editor.dev/pro`](https://www.npmjs.com/package/@docx-editor.dev/pro) | Tracked changes, comments, and custom nodes. |
166
- | [`@docx-editor.dev/editor-api`](https://www.npmjs.com/package/@docx-editor.dev/editor-api) | Office.js-compatible editing API: a batching object model, on a server or against an open editor. |
160
+ | Package | Description |
161
+ | --- | --- |
162
+ | [`@docx-editor.dev/react`](https://www.npmjs.com/package/@docx-editor.dev/react) | React adapter. `<DocxEditor>`, provider primitives, hooks, and compound chrome. |
163
+ | [`@docx-editor.dev/core`](https://www.npmjs.com/package/@docx-editor.dev/core) | Framework-agnostic engine: OOXML read/write, canonical document tree, layout, paint. |
164
+ | [`@docx-editor.dev/i18n`](https://www.npmjs.com/package/@docx-editor.dev/i18n) | Shared locale strings and types. |
165
+ | [`@docx-editor.dev/pro`](https://www.npmjs.com/package/@docx-editor.dev/pro) | Tracked changes, comments, and custom nodes. |
166
+ | [`@docx-editor.dev/editor-api`](https://www.npmjs.com/package/@docx-editor.dev/editor-api) | Supported Office.js subset for document editing on a server or in an open editor. |
167
167
 
168
168
  ## License
169
169
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docx-editor.dev/editor-api",
3
- "version": "2.21.0",
3
+ "version": "2.22.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": {
@@ -82,6 +82,6 @@
82
82
  "access": "public"
83
83
  },
84
84
  "peerDependencies": {
85
- "@docx-editor.dev/core": "~2.21.0"
85
+ "@docx-editor.dev/core": "~2.22.0"
86
86
  }
87
87
  }