@docx-editor.dev/editor-api 2.35.0-canary.20261104032723.sha-43c2012 → 2.35.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 +20 -0
- package/README.md +8 -13
- 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-DMIAaVbA.d.mts → server-CodejWwc.d.mts} +67 -3
- package/dist/{server-DMIAaVbA.d.ts → server-CodejWwc.d.ts} +67 -3
- package/docs/accept-reject-without-scrolling.md +31 -48
- package/docs/comment-on-found-text.md +47 -23
- package/docs/custom-review-cards.md +50 -34
- package/docs/highlight-ranges.md +26 -6
- package/docs/index.md +21 -21
- package/docs/propose-rewrite.md +87 -138
- package/docs/tracked-replacement.md +41 -20
- package/package.json +2 -2
package/OFFICE_JS_GUIDE.md
CHANGED
|
@@ -681,3 +681,23 @@ Do not substitute revision author settings for document author metadata. Other d
|
|
|
681
681
|
Collaborative writes require an existing core-properties part. If the input omits this part, set properties before joining collaboration. Concurrent creation of this package part cannot merge safely.
|
|
682
682
|
|
|
683
683
|
Load `properties.lastAuthor` to read the last saved author. This property has no setter. To remove all standard property parts, call `document.removeDocumentInformation('DocumentProperties')`, then `context.sync()`. Run this command alone. It removes core, extended, and custom properties, including the last author. It preserves document text, comments, revisions, and media. It does not anonymize their content. Other removal modes, tracked removal, and removal during collaboration refuse with `NotSupported`.
|
|
684
|
+
|
|
685
|
+
## Compare two documents
|
|
686
|
+
|
|
687
|
+
To record the differences between the open document and a revised copy as tracked changes, call `document.compareFromBase64(base64File, options)`. The open document is the original. This method requires `reviewModule()` from `@docx-editor.dev/pro` in the runtime `modules` list. Without it, the call refuses with `NotSupported`. Run the call alone in its sync.
|
|
688
|
+
|
|
689
|
+
```ts
|
|
690
|
+
const runtime = await DocxEditor.createServer(originalBytes, {
|
|
691
|
+
modules: [reviewModule()],
|
|
692
|
+
});
|
|
693
|
+
await runtime.run(async (context) => {
|
|
694
|
+
context.document.compareFromBase64(revisedBase64, { authorName: 'Legal' });
|
|
695
|
+
await context.sync();
|
|
696
|
+
});
|
|
697
|
+
```
|
|
698
|
+
|
|
699
|
+
Only `CompareTargetCurrent` is supported. `CompareTargetNew`, `CompareTargetSelected`, `removePersonalInformation: true`, `document.compare(filePath)`, and collaborative sessions refuse with `NotSupported`. Invalid base64 and unreadable packages refuse with `InvalidArgument`. Pass the revised document as plain base64 data; do not pass proxies to a job queue.
|
|
700
|
+
|
|
701
|
+
Without `authorName`, the revisions carry the revised document's last author, then its creator, then `Comparison`. To count the main-body result, load `document.revisions` with `'items'` after the compare's `context.sync()`.
|
|
702
|
+
|
|
703
|
+
A refused compare writes nothing. Handle `error.code` first. If `debugInfo.innerError` exists, its `code` names the cause: `edit.review-module-required`, `edit.resource-limit`, `edit.invalid-argument`, `edit.protected-content`, or `edit.unsupported-content`. Do not retry the same pair; report the cause instead.
|
package/README.md
CHANGED
|
@@ -148,7 +148,7 @@ See [Batching, loading, and errors](https://www.docx-editor.dev/docs/2.x/editor-
|
|
|
148
148
|
|
|
149
149
|
## Office.js compatibility
|
|
150
150
|
|
|
151
|
-
The API implements a documented subset of the Office.js object model. It runs
|
|
151
|
+
The API implements a documented subset of the Office.js object model. It runs without an Office.js host and does not require an Office.js package. See [Office.js compatibility](https://www.docx-editor.dev/docs/2.x/editor-api/office-js-api) for supported operations, runtime differences, and compatibility reports.
|
|
152
152
|
|
|
153
153
|
Server page-field updates require a measurer configured with font resources. See [Fields and pagination](https://www.docx-editor.dev/docs/2.x/editor-api/fields) for setup and a runnable report agent.
|
|
154
154
|
|
|
@@ -166,25 +166,20 @@ To upgrade from the former reviewer, bridge, MCP, or chat APIs, see [Migration](
|
|
|
166
166
|
|
|
167
167
|
## Which API for which job
|
|
168
168
|
|
|
169
|
-
|
|
170
|
-
| --- | --- |
|
|
171
|
-
| Build a review UI in the browser | The React or Vue adapter hooks, plus the review hooks and `DocxEditorReview` from `@docx-editor.dev/pro/react` or `@docx-editor.dev/pro/vue`. |
|
|
172
|
-
| Edit in a headless, server, or agent pipeline | The editing API in `@docx-editor.dev/editor-api`, which follows the Office.js object model. |
|
|
169
|
+
Use the React or Vue adapter hooks, the review hooks, and `DocxEditorReview` from `@docx-editor.dev/pro/react` or `@docx-editor.dev/pro/vue` to build browser review controls. Use the editing API in `@docx-editor.dev/editor-api` for document automation. It follows the Office.js object model and runs in browser and server hosts.
|
|
173
170
|
|
|
174
|
-
| Task | Browser
|
|
171
|
+
| Task | Browser controls (React or Vue) | Document automation |
|
|
175
172
|
| --- | --- | --- |
|
|
176
173
|
| [Comment on found text](https://www.docx-editor.dev/docs/2.x/recipes/comment-on-found-text) | `editor.findMatches`, `editor.selectMatch`, then `useReview().comment` | `body.search`, then `Range.insertComment` |
|
|
177
|
-
| Reply to a thread | `useReview().reply(item, text)` | `Comment.reply(text)` |
|
|
174
|
+
| [Reply to a thread](https://www.docx-editor.dev/docs/2.x/pro/comments) | `useReview().reply(item, text)` | `Comment.reply(text)` |
|
|
178
175
|
| [Record a tracked replacement](https://www.docx-editor.dev/docs/2.x/recipes/tracked-replacement) | Suggesting mode, then `editor.exec({ type: 'replaceMatch', match, text })` | `document.changeTrackingMode = 'TrackMineOnly'`, then `Range.insertText(text, 'Replace')` |
|
|
179
|
-
| [Propose an AI rewrite as tracked changes](https://www.docx-editor.dev/docs/2.x/recipes/propose-rewrite) |
|
|
176
|
+
| [Propose an AI rewrite as tracked changes](https://www.docx-editor.dev/docs/2.x/recipes/propose-rewrite) | `prepareRewrite` through `DocxEditor.createBrowser` | `prepareRewrite` from `@docx-editor.dev/editor-api/agent` |
|
|
180
177
|
| [Accept or reject a change](https://www.docx-editor.dev/docs/2.x/recipes/accept-reject-without-scrolling) | `useReview().accept(item)` or `useReview().reject(item)` | `Revision.accept()` or `Revision.reject()` |
|
|
181
|
-
| [Open
|
|
178
|
+
| [Open a change without scrolling](https://www.docx-editor.dev/docs/2.x/recipes/accept-reject-without-scrolling) | `useReview().setActive(key, { reveal: false })` | Not applicable: no viewport |
|
|
182
179
|
| [Highlight ranges](https://www.docx-editor.dev/docs/2.x/recipes/highlight-ranges) | `useHighlights(name, source, options)` | Not applicable |
|
|
183
|
-
| [Custom review rail cards](https://www.docx-editor.dev/docs/2.x/recipes/custom-review-cards) | `DocxEditorReview` with `preset` set to `false`, `
|
|
180
|
+
| [Custom review rail cards](https://www.docx-editor.dev/docs/2.x/recipes/custom-review-cards) | `DocxEditorReview` with `preset` set to `false`, `useStackedReviewPositions`, and `useReviewRailMetrics` | Not applicable |
|
|
184
181
|
| Comment-on-selection button | `DocxEditorReview.AddComment` as a direct child of `DocxEditorReview`, or `useEditorCommand('review.addComment')` | Not applicable |
|
|
185
|
-
| Page setup and paragraph dialogs
|
|
186
|
-
|
|
187
|
-
The review hooks need `reviewModule()` from `@docx-editor.dev/pro` in the editor's modules, and an editor `author` for comments and tracked changes. The editing API takes its author from the `author` option of `DocxEditor.createServer`, imported from `@docx-editor.dev/editor-api`, or of `DocxEditor.createBrowser`, imported from `@docx-editor.dev/editor-api/browser`.
|
|
182
|
+
| [Page setup and paragraph dialogs](https://www.docx-editor.dev/docs/2.x/customization/dialogs) | `DocxEditor.PageSetupDialog` or `DocxEditor.ParagraphDialog` | `Section.pageSetup`, and `Paragraph` properties such as `alignment` |
|
|
188
183
|
|
|
189
184
|
This package ships the task recipes in [`docs/index.md`](./docs/index.md). They are also on the site: [Task recipes](https://www.docx-editor.dev/docs/2.x/recipes).
|
|
190
185
|
|
package/dist/browser.d.mts
CHANGED
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
* @packageDocumentation
|
|
21
21
|
* @public
|
|
22
22
|
*/
|
|
23
|
-
import {
|
|
24
|
-
export { A as Alignment, B as BesideLocation, b as Body, c as BodyInsertParagraphLocation, d as BodyInsertTextLocation, e as Bookmark, f as BookmarkCollection, g as BreakType, h as ChangeTrackingMode, i as ChangeTrackingVersion, j as ClientObject, k as ClientResult, l as Comment, m as CommentCollection, n as CommentReply, o as CommentReplyCollection, p as CommitPreviewOptions, q as
|
|
23
|
+
import { aq as RevisionTextView, P as DocxEditorRuntime, C as CreateServerOptions, D as DocxEditorServerRuntime, a as CreateCollaborativeOptions } from './server-CodejWwc.mjs';
|
|
24
|
+
export { A as Alignment, B as BesideLocation, b as Body, c as BodyInsertParagraphLocation, d as BodyInsertTextLocation, e as Bookmark, f as BookmarkCollection, g as BreakType, h as ChangeTrackingMode, i as ChangeTrackingVersion, j as ClientObject, k as ClientResult, l as Comment, m as CommentCollection, n as CommentReply, o as CommentReplyCollection, p as CommitPreviewOptions, q as CompareTarget, r as ContentControl, s as ContentControlCollection, t as ContentControlLockState, u as ContentControlSubtype, v as ContentControlType, w as ContentControlValue, x as Document, y as DocumentCapabilities, z as DocumentCompareOptions, E as DocumentLimits, F as DocumentPreview, G as DocumentPreviewStatus, H as DocumentProperties, I as DocumentXmlLimits, J as DocumentZipLimits, K as DocxEditorDebugInfo, L as DocxEditorError, M as DocxEditorErrorCode, N as DocxEditorErrorInit, O as DocxEditorInnerError, Q as EditorModule, R as Field, S as FieldCollection, T as FieldType, U as FieldTypeLiteral, V as Font, W as HeaderFooterType, X as InlinePicture, Y as InlinePictureCollection, Z as InsertLocation, _ as List, $ as ListBullet, a0 as ListCollection, a1 as ListItem, a2 as ListNumbering, a3 as LoadOption, a4 as LoadQueryOptions, a5 as NoteItem, a6 as NoteItemCollection, a7 as NoteItemType, a8 as PageOrientation, a9 as PageSetup, aa as Paragraph, ab as ParagraphAlignment, ac as ParagraphCollection, ad as ParagraphInsertTextLocation, ae as ParagraphReadingOrder, af as PreviewCallback, ag as Range, ah as RangeCollection, ai as RangeInsertTextLocation, aj as RangeLocation, ak as RemoveDocInfoType, al as RequestContext, am as Revision, an as RevisionAuthorOptions, ao as RevisionAuthorSelection, ap as RevisionCollection, ar as RevisionType, as as RunCallback, at as RunOptions, au as RuntimeDiagnostic, av as SearchOptions, aw as Section, ax as SectionCollection, ay as SelectionMode, az as ServerPaginationOptions, aA as Shape, aB as ShapeCollection, aC as ShapeType, aD as Style, aE as StyleCollection, aF as StyleType, aG as Table, aH as TableCell, aI as TableCellCollection, aJ as TableCollection, aK as TableRow, aL as TableRowCollection, aM as TrackedObjects, aN as UnderlineType, aO as VerticalAlignment, aP as getReviewItemRange, aQ as getReviewItemRangeOrNullObject, aR as getReviewItemRevisions, aS as isDocxEditorError } from './server-CodejWwc.mjs';
|
|
25
25
|
import { EditorCollaborationSession } from '@docx-editor.dev/core/collaboration';
|
|
26
26
|
export { HistoryGroup, HistoryGroupOutcome, RevisionAuthorEntry, RevisionAuthorResult, RevisionAuthorSkipReason, RevisionBatchEntry, RevisionBatchResult, RevisionBatchSkipReason } from '@docx-editor.dev/core/automation';
|
|
27
27
|
import { DocxEditorInstance } from '@docx-editor.dev/core/editor';
|
package/dist/browser.d.ts
CHANGED
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
* @packageDocumentation
|
|
21
21
|
* @public
|
|
22
22
|
*/
|
|
23
|
-
import {
|
|
24
|
-
export { A as Alignment, B as BesideLocation, b as Body, c as BodyInsertParagraphLocation, d as BodyInsertTextLocation, e as Bookmark, f as BookmarkCollection, g as BreakType, h as ChangeTrackingMode, i as ChangeTrackingVersion, j as ClientObject, k as ClientResult, l as Comment, m as CommentCollection, n as CommentReply, o as CommentReplyCollection, p as CommitPreviewOptions, q as
|
|
23
|
+
import { aq as RevisionTextView, P as DocxEditorRuntime, C as CreateServerOptions, D as DocxEditorServerRuntime, a as CreateCollaborativeOptions } from './server-CodejWwc.js';
|
|
24
|
+
export { A as Alignment, B as BesideLocation, b as Body, c as BodyInsertParagraphLocation, d as BodyInsertTextLocation, e as Bookmark, f as BookmarkCollection, g as BreakType, h as ChangeTrackingMode, i as ChangeTrackingVersion, j as ClientObject, k as ClientResult, l as Comment, m as CommentCollection, n as CommentReply, o as CommentReplyCollection, p as CommitPreviewOptions, q as CompareTarget, r as ContentControl, s as ContentControlCollection, t as ContentControlLockState, u as ContentControlSubtype, v as ContentControlType, w as ContentControlValue, x as Document, y as DocumentCapabilities, z as DocumentCompareOptions, E as DocumentLimits, F as DocumentPreview, G as DocumentPreviewStatus, H as DocumentProperties, I as DocumentXmlLimits, J as DocumentZipLimits, K as DocxEditorDebugInfo, L as DocxEditorError, M as DocxEditorErrorCode, N as DocxEditorErrorInit, O as DocxEditorInnerError, Q as EditorModule, R as Field, S as FieldCollection, T as FieldType, U as FieldTypeLiteral, V as Font, W as HeaderFooterType, X as InlinePicture, Y as InlinePictureCollection, Z as InsertLocation, _ as List, $ as ListBullet, a0 as ListCollection, a1 as ListItem, a2 as ListNumbering, a3 as LoadOption, a4 as LoadQueryOptions, a5 as NoteItem, a6 as NoteItemCollection, a7 as NoteItemType, a8 as PageOrientation, a9 as PageSetup, aa as Paragraph, ab as ParagraphAlignment, ac as ParagraphCollection, ad as ParagraphInsertTextLocation, ae as ParagraphReadingOrder, af as PreviewCallback, ag as Range, ah as RangeCollection, ai as RangeInsertTextLocation, aj as RangeLocation, ak as RemoveDocInfoType, al as RequestContext, am as Revision, an as RevisionAuthorOptions, ao as RevisionAuthorSelection, ap as RevisionCollection, ar as RevisionType, as as RunCallback, at as RunOptions, au as RuntimeDiagnostic, av as SearchOptions, aw as Section, ax as SectionCollection, ay as SelectionMode, az as ServerPaginationOptions, aA as Shape, aB as ShapeCollection, aC as ShapeType, aD as Style, aE as StyleCollection, aF as StyleType, aG as Table, aH as TableCell, aI as TableCellCollection, aJ as TableCollection, aK as TableRow, aL as TableRowCollection, aM as TrackedObjects, aN as UnderlineType, aO as VerticalAlignment, aP as getReviewItemRange, aQ as getReviewItemRangeOrNullObject, aR as getReviewItemRevisions, aS as isDocxEditorError } from './server-CodejWwc.js';
|
|
25
25
|
import { EditorCollaborationSession } from '@docx-editor.dev/core/collaboration';
|
|
26
26
|
export { HistoryGroup, HistoryGroupOutcome, RevisionAuthorEntry, RevisionAuthorResult, RevisionAuthorSkipReason, RevisionBatchEntry, RevisionBatchResult, RevisionBatchSkipReason } from '@docx-editor.dev/core/automation';
|
|
27
27
|
import { DocxEditorInstance } from '@docx-editor.dev/core/editor';
|