@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.
@@ -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 independently of Office and does not require a Microsoft 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.
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
- | Job | Use |
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 host (React or Vue) | Headless, server, or agent |
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) | The same code through `DocxEditor.createBrowser` from `@docx-editor.dev/editor-api/browser` | `prepareRewrite` from `@docx-editor.dev/editor-api/agent` |
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 or reveal 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 |
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`, `useReview().items`, `useStackedReviewPositions`, and `useReviewRailMetrics` | Not applicable |
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 from a custom toolbar | `DocxEditor.PageSetupDialog` or `DocxEditor.ParagraphDialog` with `open` and a close handler (`onClose` in React, `@close` in Vue); enable the button from `usePageSetup().isEnabled` or `useParagraphFormat().isEnabled` | `Section.pageSetup`, and `Paragraph` properties such as `alignment` |
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
 
@@ -20,8 +20,8 @@
20
20
  * @packageDocumentation
21
21
  * @public
22
22
  */
23
- import { ao as RevisionTextView, N as DocxEditorRuntime, C as CreateServerOptions, D as DocxEditorServerRuntime, a as CreateCollaborativeOptions } from './server-DMIAaVbA.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 ContentControl, r as ContentControlCollection, s as ContentControlLockState, t as ContentControlSubtype, u as ContentControlType, v as ContentControlValue, w as Document, x as DocumentCapabilities, y as DocumentLimits, z as DocumentPreview, E as DocumentPreviewStatus, F as DocumentProperties, G as DocumentXmlLimits, H as DocumentZipLimits, I as DocxEditorDebugInfo, J as DocxEditorError, K as DocxEditorErrorCode, L as DocxEditorErrorInit, M as DocxEditorInnerError, O as EditorModule, P as Field, Q as FieldCollection, R as FieldType, S as FieldTypeLiteral, T as Font, U as HeaderFooterType, V as InlinePicture, W as InlinePictureCollection, X as InsertLocation, Y as List, Z as ListBullet, _ as ListCollection, $ as ListItem, a0 as ListNumbering, a1 as LoadOption, a2 as LoadQueryOptions, a3 as NoteItem, a4 as NoteItemCollection, a5 as NoteItemType, a6 as PageOrientation, a7 as PageSetup, a8 as Paragraph, a9 as ParagraphAlignment, aa as ParagraphCollection, ab as ParagraphInsertTextLocation, ac as ParagraphReadingOrder, ad as PreviewCallback, ae as Range, af as RangeCollection, ag as RangeInsertTextLocation, ah as RangeLocation, ai as RemoveDocInfoType, aj as RequestContext, ak as Revision, al as RevisionAuthorOptions, am as RevisionAuthorSelection, an as RevisionCollection, ap as RevisionType, aq as RunCallback, ar as RunOptions, as as RuntimeDiagnostic, at as SearchOptions, au as Section, av as SectionCollection, aw as SelectionMode, ax as ServerPaginationOptions, ay as Shape, az as ShapeCollection, aA as ShapeType, aB as Style, aC as StyleCollection, aD as StyleType, aE as Table, aF as TableCell, aG as TableCellCollection, aH as TableCollection, aI as TableRow, aJ as TableRowCollection, aK as TrackedObjects, aL as UnderlineType, aM as VerticalAlignment, aN as getReviewItemRange, aO as getReviewItemRangeOrNullObject, aP as getReviewItemRevisions, aQ as isDocxEditorError } from './server-DMIAaVbA.mjs';
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 { ao as RevisionTextView, N as DocxEditorRuntime, C as CreateServerOptions, D as DocxEditorServerRuntime, a as CreateCollaborativeOptions } from './server-DMIAaVbA.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 ContentControl, r as ContentControlCollection, s as ContentControlLockState, t as ContentControlSubtype, u as ContentControlType, v as ContentControlValue, w as Document, x as DocumentCapabilities, y as DocumentLimits, z as DocumentPreview, E as DocumentPreviewStatus, F as DocumentProperties, G as DocumentXmlLimits, H as DocumentZipLimits, I as DocxEditorDebugInfo, J as DocxEditorError, K as DocxEditorErrorCode, L as DocxEditorErrorInit, M as DocxEditorInnerError, O as EditorModule, P as Field, Q as FieldCollection, R as FieldType, S as FieldTypeLiteral, T as Font, U as HeaderFooterType, V as InlinePicture, W as InlinePictureCollection, X as InsertLocation, Y as List, Z as ListBullet, _ as ListCollection, $ as ListItem, a0 as ListNumbering, a1 as LoadOption, a2 as LoadQueryOptions, a3 as NoteItem, a4 as NoteItemCollection, a5 as NoteItemType, a6 as PageOrientation, a7 as PageSetup, a8 as Paragraph, a9 as ParagraphAlignment, aa as ParagraphCollection, ab as ParagraphInsertTextLocation, ac as ParagraphReadingOrder, ad as PreviewCallback, ae as Range, af as RangeCollection, ag as RangeInsertTextLocation, ah as RangeLocation, ai as RemoveDocInfoType, aj as RequestContext, ak as Revision, al as RevisionAuthorOptions, am as RevisionAuthorSelection, an as RevisionCollection, ap as RevisionType, aq as RunCallback, ar as RunOptions, as as RuntimeDiagnostic, at as SearchOptions, au as Section, av as SectionCollection, aw as SelectionMode, ax as ServerPaginationOptions, ay as Shape, az as ShapeCollection, aA as ShapeType, aB as Style, aC as StyleCollection, aD as StyleType, aE as Table, aF as TableCell, aG as TableCellCollection, aH as TableCollection, aI as TableRow, aJ as TableRowCollection, aK as TrackedObjects, aL as UnderlineType, aM as VerticalAlignment, aN as getReviewItemRange, aO as getReviewItemRangeOrNullObject, aP as getReviewItemRevisions, aQ as isDocxEditorError } from './server-DMIAaVbA.js';
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';