New

docx-editor 1.x has shipped. Vue support, i18n, agents. Read the migration guide →

API Referencev1.3.2

@eigenpal/docx-editor-core/prosemirror/commentOps

Functions(3)

Locate the comment range (paragraph, narrowed by `search`), add the comment mark, dispatch, and return the created Comment. Returns null when the schema lacks a comment mark or the range can't be resolved. The caller owns adding the comment to its own state and showing the sidebar.

declare function addCommentToRange(view: EditorView, options: AddCommentOptions, allocator: CommentIdAllocator): Comment | null;

Apply a tracked change (insertion / deletion / replace) to the located range. `search === ''` means a pure insertion at the paragraph end; `replaceWith === ''` means a pure deletion. Refuses to layer onto an existing tracked change. Returns true when a change was dispatched, false otherwise.

declare function applyProposedChange(view: EditorView, options: ProposeChangeOptions, allocator: CommentIdAllocator): boolean;

Build a Comment object with a freshly-allocated ID.

declare function createComment(allocator: CommentIdAllocator, text: string, authorName: string, parentId?: number): Comment;

Interfaces(2)

interface AddCommentOptions
MemberTypeSummary
authorstring
paraIdstring
textstring
interface ProposeChangeOptions
MemberTypeSummary
authorstring
paraIdstring
replaceWithstring