Comments
components/demo.tsx
Installation
npm install @udecode/plate-comments
Usage
import { CommentsPlugin } from '@udecode/plate-comments/react';
const editor = createPlateEditor({
plugins: [
// ...otherPlugins,
CommentsPlugin,
],
});
Keyboard Shortcuts
Key | Description |
---|---|
Cmd + Shift + M | Add a comment on the selected text. |
Plugins
CommentsPlugin
Transforms
editor.tf.insert.comment
Insert a new comment mark.
editor.api.comment.updateComment
Updates an existing comment.
editor.api.comment.addRawComment
Adds a new raw comment.
editor.api.comment.addComment
Adds a new comment.
editor.api.comment.removeComment
Removes a comment.
editor.api.comment.resetNewCommentValue
Resets the value of a new comment.
Store State
CommentStoreState
Utils
findCommentNode
findCommentNodeById
getCommentCount
getCommentKey
getCommentKeyId
getCommentKeys
getCommentNodeEntries
getCommentNodesById
getCommentPosition
getCommentUrl
getElementAbsolutePosition
isCommentKey
isCommentNodeById
isCommentText
removeCommentMark
unsetCommentNodesById
Components
<CommentProvider>
<CommentDeleteButton>
<CommentEditButton>
<CommentEditCancelButton>
Button component for canceling comment edits.
<CommentEditSaveButton>
<CommentEditTextarea>
<CommentNewSubmitButton>
<CommentNewTextarea>
<CommentResolveButton>
Button component for resolving/unresolving comments.
<CommentUserName>
Component for displaying a comment user's name.