A toolbar button for adding inline comments.
'use client';
import * as React from 'react';
import { MessageSquareTextIcon } from 'lucide-react';
import { useEditorRef } from 'platejs/react';
import { commentPlugin } from '@/registry/components/editor/plugins/comment-kit';
import { ToolbarButton } from './toolbar';
export function CommentToolbarButton() {
const editor = useEditorRef();
return (
<ToolbarButton
onClick={() => {
editor.getTransforms(commentPlugin).comment.setDraft();
}}
data-plate-prevent-overlay
tooltip="Comment"
>
<MessageSquareTextIcon />
</ToolbarButton>
);
}
npx shadcn@latest add @plate/comment-toolbar-buttonimport { CommentToolbarButton } from "@/components/ui/comment-toolbar-button"<CommentToolbarButton />