oasis-editor 0.0.204 → 0.0.206

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,2 +1,2 @@
1
- export declare const OASIS_BUILTIN_COMMANDS: readonly ["selectAll", "insertFootnote", "insertText", "insertEquation", "updateEquation", "insertTableOfContents", "updateTableOfContents", "pastePlainText", "paste", "pasteAsPlainText", "pasteMergeFormatting", "formatPainter", "formatPainterContinuous", "cancelFormatPainter", "bold", "italic", "underline", "strike", "superscript", "subscript", "link", "unlink", "alignLeft", "alignCenter", "alignRight", "alignJustify", "orderedList", "bulletList", "find", "replace", "toggleTrackChanges", "acceptRevisions", "rejectRevisions", "nextRevision", "previousRevision", "nextComment", "previousComment", "newComment", "replyComment", "resolveComment", "reopenComment", "deleteComment", "toggleShowMargins", "toggleShowParagraphMarks", "togglePreciseFonts", "undo", "redo", "pageBreak", "lineBreak", "splitBlock", "setFontFamily", "setFontSize", "increaseFontSize", "decreaseFontSize", "changeTextCase", "clearFormatting", "setColor", "setHighlight", "setTextShading", "setStyleId", "setCharacterStyleId", "setUnderlineStyle", "documentStyles", "print", "copy", "cut", "newDocument", "exportDocx", "exportPdf", "importDocument", "insertHtml", "insertImage", "editImageAlt", "insertImageCaption", "imageContext", "imageWidthCm", "imageHeightCm", "imageCrop", "imageCropAspect", "imageCropShape", "imageCropFill", "imageCropFit", "imageCropReset", "imageBorder", "outdent", "indent", "togglePageBreakBefore", "toggleKeepWithNext", "setSpacingAfter", "setSpacingBefore", "setIndentLeft", "setIndentRight", "setIndentFirstLine", "setIndentHanging", "setSpecialIndent", "setParagraphShading", "applyParagraphBorders", "setLineHeight", "setListFormat", "setListStartAt", "toggleOrientation", "setOrientation", "sectionBreakNextPage", "sectionBreakContinuous", "setPageMargins", "applyDocumentTheme", "setDocumentColorScheme", "setDocumentFontScheme", "setDocumentParagraphSpacing", "setDocumentEffects", "setDocumentPageColor", "setDocumentWatermark", "setDocumentPageBorder", "setDocumentDesignDefault", "tableContext", "tableMerge", "tableSplit", "tableInsertColumnBefore", "tableInsertColumnAfter", "tableDeleteColumn", "tableInsertRowBefore", "tableInsertRowAfter", "tableDeleteRow", "tableCellShading", "tableCellBorders", "tableCellNoBorders", "tableApplyBorderPreset", "toggleTableDrawBorders", "toggleTableGridlines", "tableWidth100", "tableAlignLeft", "tableAlignCenter", "tableAlignRight", "tableSetCellWidth", "tableToggleHeaderRow", "tableToggleTotalRow", "tableToggleBandedRows", "tableToggleFirstColumn", "tableToggleLastColumn", "tableToggleBandedColumns", "setTableStyle", "tableToggleAutoFit", "tableDistributeColumns", "tableDistributeRows", "insertTable", "insertShape", "openSymbolDialog", "openEquationDialog"];
1
+ export declare const OASIS_BUILTIN_COMMANDS: readonly ["selectAll", "insertFootnote", "insertText", "insertEquation", "updateEquation", "insertTableOfContents", "updateTableOfContents", "pastePlainText", "paste", "pasteAsPlainText", "pasteMergeFormatting", "formatPainter", "formatPainterContinuous", "cancelFormatPainter", "bold", "italic", "underline", "strike", "superscript", "subscript", "link", "unlink", "alignLeft", "alignCenter", "alignRight", "alignJustify", "orderedList", "bulletList", "find", "replace", "toggleTrackChanges", "acceptRevisions", "rejectRevisions", "nextRevision", "previousRevision", "nextComment", "previousComment", "newComment", "replyComment", "editComment", "toggleCommentsPanel", "resolveComment", "reopenComment", "deleteComment", "toggleShowMargins", "toggleShowParagraphMarks", "togglePreciseFonts", "undo", "redo", "pageBreak", "lineBreak", "splitBlock", "setFontFamily", "setFontSize", "increaseFontSize", "decreaseFontSize", "changeTextCase", "clearFormatting", "setColor", "setHighlight", "setTextShading", "setStyleId", "setCharacterStyleId", "setUnderlineStyle", "documentStyles", "print", "copy", "cut", "newDocument", "exportDocx", "exportPdf", "importDocument", "insertHtml", "insertImage", "editImageAlt", "insertImageCaption", "imageContext", "imageWidthCm", "imageHeightCm", "imageCrop", "imageCropAspect", "imageCropShape", "imageCropFill", "imageCropFit", "imageCropReset", "imageBorder", "outdent", "indent", "togglePageBreakBefore", "toggleKeepWithNext", "setSpacingAfter", "setSpacingBefore", "setIndentLeft", "setIndentRight", "setIndentFirstLine", "setIndentHanging", "setSpecialIndent", "setParagraphShading", "applyParagraphBorders", "setLineHeight", "setListFormat", "setListStartAt", "toggleOrientation", "setOrientation", "sectionBreakNextPage", "sectionBreakContinuous", "setPageMargins", "applyDocumentTheme", "setDocumentColorScheme", "setDocumentFontScheme", "setDocumentParagraphSpacing", "setDocumentEffects", "setDocumentPageColor", "setDocumentWatermark", "setDocumentPageBorder", "setDocumentDesignDefault", "tableContext", "tableMerge", "tableSplit", "tableInsertColumnBefore", "tableInsertColumnAfter", "tableDeleteColumn", "tableInsertRowBefore", "tableInsertRowAfter", "tableDeleteRow", "tableCellShading", "tableCellBorders", "tableCellNoBorders", "tableApplyBorderPreset", "toggleTableDrawBorders", "toggleTableGridlines", "tableWidth100", "tableAlignLeft", "tableAlignCenter", "tableAlignRight", "tableSetCellWidth", "tableToggleHeaderRow", "tableToggleTotalRow", "tableToggleBandedRows", "tableToggleFirstColumn", "tableToggleLastColumn", "tableToggleBandedColumns", "setTableStyle", "tableToggleAutoFit", "tableDistributeColumns", "tableDistributeRows", "insertTable", "insertShape", "openSymbolDialog", "openEquationDialog"];
2
2
  export type OasisBuiltinCommand = (typeof OASIS_BUILTIN_COMMANDS)[number];
@@ -4,6 +4,7 @@ export interface CommentContent {
4
4
  author: string;
5
5
  text: string;
6
6
  date: number;
7
+ authorId?: string;
7
8
  }
8
9
  export interface CommentRange {
9
10
  start: EditorCommentAnchor;
@@ -21,3 +22,9 @@ export declare function insertCommentAtSelection(state: EditorState, content: Co
21
22
  export declare function replyToComment(state: EditorState, parentId: string, content: CommentContent): EditorState;
22
23
  /** Render a nested discussion in document insertion order without duplicating anchors. */
23
24
  export declare function collectCommentThreadReplies(comments: Readonly<Record<string, EditorComment>>, parentId: string): EditorComment[];
25
+ /**
26
+ * Modify only the comment body. Keep its stable id, author, creation date,
27
+ * anchors, resolved flag and parent id for reliable DOCX round-tripping.
28
+ * A blank body or identical normalized value produces no transaction.
29
+ */
30
+ export declare function editCommentText(state: EditorState, commentId: string, text: string): EditorState;
@@ -0,0 +1,17 @@
1
+ import { EditorComment, EditorComments } from '../model.js';
2
+ /** Policy data is owned by core; UI is a consumer, not a dependency. */
3
+ export interface OasisReviewAccess {
4
+ identity?: {
5
+ id: string;
6
+ displayName: string;
7
+ };
8
+ canModerate?: boolean;
9
+ }
10
+ /**
11
+ * Standalone / not configured: legacy local editing remains permissive.
12
+ * Configured: only the trusted, stable host actor ID owns a comment.
13
+ * Imported DOCX author names are presentation data, never proof of identity.
14
+ */
15
+ export declare function canEditReviewComment(access: OasisReviewAccess | undefined, comment: EditorComment | undefined): boolean;
16
+ /** Deleting a thread also deletes its descendants, so verify every author. */
17
+ export declare function canDeleteReviewThread(access: OasisReviewAccess | undefined, registry: EditorComments | undefined, id: string): boolean;
@@ -70,6 +70,8 @@ export interface OasisCommandPayloads {
70
70
  previousComment: undefined;
71
71
  newComment: undefined;
72
72
  replyComment: undefined;
73
+ editComment: undefined;
74
+ toggleCommentsPanel: undefined;
73
75
  resolveComment: undefined;
74
76
  reopenComment: undefined;
75
77
  deleteComment: undefined;
@@ -16,11 +16,19 @@ export declare function navigateComment(state: EditorState, direction: "next" |
16
16
  * overlapping comment. Replies without anchors are managed by parent id.
17
17
  */
18
18
  export declare function getSelectedReviewComment(state: EditorState): EditorComment | null;
19
- /** Keep all comment metadata/anchors intact for DOCX round-trip. */
19
+ /**
20
+ * Jump to an anchored comment in the active section/zone. A reply navigates
21
+ * to its closest anchored ancestor, without changing document text.
22
+ */
23
+ export declare function focusReviewCommentById(state: EditorState, id: string): EditorState;
24
+ export declare function setReviewCommentResolvedById(state: EditorState, id: string, resolved: boolean): EditorState;
25
+ /** The selected-comment actions share the same immutable ID based mutations. */
20
26
  export declare function setSelectedCommentResolved(state: EditorState, resolved: boolean): EditorState;
21
27
  /**
22
- * Deleting a parent thread deletes all its descendants, preventing dangling
23
- * parentId pointers in commentsExtended.xml.
28
+ * Remove a discussion and all descendants; never leave orphaned parent ids.
29
+ * This pure model operation intentionally has no knowledge of authenticated
30
+ * users: the editor command host must check permissions before invoking it.
24
31
  */
32
+ export declare function deleteReviewCommentById(state: EditorState, id: string): EditorState;
25
33
  export declare function deleteSelectedComment(state: EditorState): EditorState;
26
34
  export {};
@@ -30,6 +30,11 @@ export interface EditorComment {
30
30
  docxIdHint?: number;
31
31
  /** `w:comment/@w:author`. */
32
32
  author: string;
33
+ /**
34
+ * Application-local stable author identity. DOCX stores only display names;
35
+ * this field is not silently reconstructed from a DOCX author on import.
36
+ */
37
+ authorId?: string;
33
38
  /** `w:comment/@w:initials`. */
34
39
  initials?: string;
35
40
  /** `w:comment/@w:date` as an epoch millisecond timestamp. */