@docx-editor.dev/core/prosemirror/commentIdAllocator
Functions (2)
createCommentIdAllocatorfunctionSource ↗
Create an instance-scoped monotonic comment/revision ID allocator. IDs are never reused (deleting a comment does not free its ID), and the counter is private to this allocator — multiple editors get independent ID spaces.
declare function createCommentIdAllocator(): CommentIdAllocator;seedCommentAllocatorfunctionSource ↗
Seed an allocator above every comment/revision ID currently in the document — comment objects (including replies, which carry no mark) plus tracked-change revisionId marks. Because seedAbove only ever raises the counter, this is safe to call on load (React) or before each allocation (Vue): new IDs never collide with or reuse an existing one, and the comment and revision ID spaces stay unified.
declare function seedCommentAllocator(allocator: CommentIdAllocator, comments: Comment[] | undefined, view: EditorView | null): void;Interfaces (1)
CommentIdAllocatorinterfaceSource ↗
interface CommentIdAllocator| Member | Type | Summary |
|---|---|---|
| next | | Allocate the next ID and advance the counter. |
| seedAbove | | On document load, bump the counter above the highest ID found in the loaded comments and tracked-change marks so subsequent allocations don't collide with already-present IDs. |
Variables (1)
PENDING_COMMENT_IDconstSource ↗
Sentinel ID for a comment that hasn't been persisted yet (anchored to selection).
PENDING_COMMENT_ID = -1