@docx-editor.dev/core/prosemirror/commentOps

Functions (3)

addCommentToRangefunctionSource ↗

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;

applyProposedChangefunctionSource ↗

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;

createCommentfunctionSource ↗

Build a Comment object with a freshly-allocated ID.

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

Interfaces (2)

AddCommentOptionsinterfaceSource ↗

interface AddCommentOptions
MemberTypeSummary
authorstring
paraIdstring
textstring

ProposeChangeOptionsinterfaceSource ↗

interface ProposeChangeOptions
MemberTypeSummary
authorstring
paraIdstring
replaceWithstring

On this page