@docx-editor.dev/editor-api 2.21.0 → 2.21.1
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 +17 -17
- package/README.md +23 -23
- package/package.json +1 -1
package/OFFICE_JS_GUIDE.md
CHANGED
|
@@ -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
|
|
102
|
-
|
|
|
103
|
-
| `PropertyNotLoaded`
|
|
104
|
-
| `InvalidObjectPath`
|
|
105
|
-
| `StaleDocument`
|
|
106
|
-
| `ConflictingChanges` | Separate edits that claim the same paragraph and reconsider anchors between commits.
|
|
107
|
-
| `NotSupported`
|
|
108
|
-
| `NotImplemented`
|
|
109
|
-
| `InvalidArgument`
|
|
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
|
|
114
|
-
|
|
|
115
|
-
| Track this agent's text edits
|
|
116
|
-
| Insert before or after a range
|
|
117
|
-
| Replace a range
|
|
118
|
-
| Delete range content
|
|
119
|
-
| Read the current mode
|
|
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,7 +7,7 @@
|
|
|
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-
|
|
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>
|
|
@@ -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
|
|
32
|
-
|
|
|
33
|
-
| Read, insert, replace, or remove text
|
|
34
|
-
| Find matches, split paragraphs, or use bookmarks
|
|
35
|
-
| Set fonts, paragraph properties, styles, or links
|
|
36
|
-
| Create and configure lists
|
|
37
|
-
| Work with table values, rows, columns, and cells
|
|
38
|
-
| Insert and resize images
|
|
39
|
-
| Calculate PAGE and NUMPAGES
|
|
40
|
-
| Set page geometry and edit headers, footers, or notes
|
|
41
|
-
| Fill template controls and edit their metadata
|
|
42
|
-
| Discuss content and manage threads
|
|
43
|
-
| Create, inspect, accept, or reject tracked changes
|
|
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(); //
|
|
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}`);
|
|
@@ -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
|
|
161
|
-
|
|
|
162
|
-
| [`@docx-editor.dev/react`](https://www.npmjs.com/package/@docx-editor.dev/react)
|
|
163
|
-
| [`@docx-editor.dev/core`](https://www.npmjs.com/package/@docx-editor.dev/core)
|
|
164
|
-
| [`@docx-editor.dev/i18n`](https://www.npmjs.com/package/@docx-editor.dev/i18n)
|
|
165
|
-
| [`@docx-editor.dev/pro`](https://www.npmjs.com/package/@docx-editor.dev/pro)
|
|
166
|
-
| [`@docx-editor.dev/editor-api`](https://www.npmjs.com/package/@docx-editor.dev/editor-api) | Office.js
|
|
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.
|
|
3
|
+
"version": "2.21.1",
|
|
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": {
|