velt-comments-best-practices
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseVelt Comments Best Practices
Velt Comments 最佳实践
Comprehensive implementation guide for Velt's collaborative comments feature in React and Next.js applications. Contains 36 rules across 9 categories, prioritized by impact to guide automated code generation and integration patterns.
本文是针对React和Next.js应用中Velt协作评论功能的全面实现指南。包含9个类别共36条规则,按影响优先级排序,可指导自动化代码生成与集成模式。
When to Apply
适用场景
Reference these guidelines when:
- Adding collaborative commenting to a React/Next.js application
- Implementing any Velt comment mode (Freestyle, Popover, Stream, Text, Page, Inline)
- Integrating comments with rich text editors (TipTap, SlateJS, Lexical)
- Adding comments to media players (Video, Lottie animations)
- Adding comments to charts (Highcharts, ChartJS, Nivo)
- Building custom comment interfaces with standalone components
在以下场景中可参考这些指南:
- 为React/Next.js应用添加协作评论功能
- 实现任意Velt评论模式(自由样式、弹出框、信息流、文本、页面、内联)
- 集成富文本编辑器评论(TipTap、SlateJS、Lexical)
- 为媒体播放器添加评论(视频、Lottie动画)
- 为图表添加评论(Highcharts、ChartJS、Nivo)
- 使用独立组件构建自定义评论界面
Rule Categories by Priority
按优先级划分的规则类别
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Core Setup | CRITICAL | |
| 2 | Comment Modes | HIGH | |
| 3 | Standalone Components | MEDIUM-HIGH | |
| 4 | Comment Surfaces | MEDIUM-HIGH | |
| 5 | UI Customization | MEDIUM | |
| 6 | Data Model | MEDIUM | |
| 7 | Debugging & Testing | LOW-MEDIUM | |
| 8 | Moderation & Permissions | LOW | |
| 9 | Attachments & Reactions | MEDIUM | |
| 优先级 | 类别 | 影响程度 | 前缀 |
|---|---|---|---|
| 1 | 核心配置 | 关键 | |
| 2 | 评论模式 | 高 | |
| 3 | 独立组件 | 中高 | |
| 4 | 评论界面载体 | 中高 | |
| 5 | UI定制 | 中 | |
| 6 | 数据模型 | 中 | |
| 7 | 调试与测试 | 中低 | |
| 8 | 审核与权限 | 低 | |
| 9 | 附件与互动 | 中 | |
Quick Reference
快速参考
1. Core Setup (CRITICAL)
1. 核心配置(关键)
- - Initialize VeltProvider with API key
core-provider-setup - - Authenticate users before using comments
core-authentication - - Configure document context for comments
core-document-setup
- - 使用API密钥初始化VeltProvider
core-provider-setup - - 使用评论功能前先完成用户认证
core-authentication - - 配置评论的文档上下文
core-document-setup
2. Comment Modes (HIGH)
2. 评论模式(高)
- - Pin comments anywhere on page
mode-freestyle - - Google Sheets-style cell comments
mode-popover - - Google Docs-style sidebar stream
mode-stream - - Text highlight comments
mode-text - - Page-level comments via sidebar
mode-page - - Traditional inline thread style
mode-inline-comments - - TipTap editor integration
mode-tiptap - - SlateJS editor integration
mode-slatejs - - Lexical editor integration
mode-lexical - - Canvas/drawing comments
mode-canvas - - Lottie animation frame comments
mode-lottie-player - - Velt prebuilt video player
mode-video-player-prebuilt - - Custom video player integration
mode-video-player-custom - - Highcharts data point comments
mode-chart-highcharts - - ChartJS data point comments
mode-chart-chartjs - - Nivo charts data point comments
mode-chart-nivo - - Custom chart integration
mode-chart-custom
- - 在页面任意位置固定评论
mode-freestyle - - 类似Google Sheets的单元格评论
mode-popover - - 类似Google Docs的侧边栏信息流评论
mode-stream - - 文本高亮评论
mode-text - - 通过侧边栏添加页面级评论
mode-page - - 传统内联线程式评论
mode-inline-comments - - TipTap编辑器集成
mode-tiptap - - SlateJS编辑器集成
mode-slatejs - - Lexical编辑器集成
mode-lexical - - 画布/绘图评论
mode-canvas - - Lottie动画帧评论
mode-lottie-player - - Velt预构建视频播放器
mode-video-player-prebuilt - - 自定义视频播放器集成
mode-video-player-custom - - Highcharts数据点评论
mode-chart-highcharts - - ChartJS数据点评论
mode-chart-chartjs - - Nivo图表数据点评论
mode-chart-nivo - - 自定义图表集成
mode-chart-custom
3. Standalone Components (MEDIUM-HIGH)
3. 独立组件(中高)
- - Manual comment pin positioning
standalone-comment-pin - - Render comment threads
standalone-comment-thread - - Add comments programmatically
standalone-comment-composer
- - 手动定位固定评论
standalone-comment-pin - - 渲染评论线程
standalone-comment-thread - - 以编程方式添加评论
standalone-comment-composer
4. Comment Surfaces (MEDIUM-HIGH)
4. 评论界面载体(中高)
- - Comments sidebar component
surface-sidebar - - Toggle sidebar button
surface-sidebar-button
- - 评论侧边栏组件
surface-sidebar - - 侧边栏切换按钮
surface-sidebar-button
5. UI Customization (MEDIUM)
5. UI定制(中)
- - Customize comment dialog
ui-comment-dialog - - Customize comment bubble
ui-comment-bubble - - Use wireframe components
ui-wireframes
- - 定制评论对话框
ui-comment-dialog - - 定制评论气泡
ui-comment-bubble - - 使用线框组件
ui-wireframes
6. Data Model (MEDIUM)
6. 数据模型(中)
- - Add custom metadata
data-context-metadata - - Work with annotations
data-comment-annotations - - Filter and group comments
data-filtering-grouping
- - 添加自定义元数据
data-context-metadata - - 处理注释内容
data-comment-annotations - - 过滤和分组评论
data-filtering-grouping
7. Debugging & Testing (LOW-MEDIUM)
7. 调试与测试(中低)
- - Common issues and solutions
debug-common-issues - - Verification checklist
debug-verification
- - 常见问题及解决方案
debug-common-issues - - 验证检查清单
debug-verification
8. Moderation & Permissions (LOW)
8. 审核与权限(低)
- - Control global comment visibility with enablePrivateMode/disablePrivateMode and update per-annotation visibility with updateVisibility
permissions-private-mode - - Subscribe to the commentSaved event for reliable post-persist side-effects (webhooks, analytics, external sync)
permissions-comment-saved-event
- - 使用enablePrivateMode/disablePrivateMode控制全局评论可见性,通过updateVisibility更新单个注释的可见性
permissions-private-mode - - 订阅commentSaved事件以实现可靠的持久化后副作用(Webhooks、分析、外部同步)
permissions-comment-saved-event
9. Attachments & Reactions (MEDIUM)
9. 附件与互动(中)
- - Control attachment download behavior and intercept clicks
attach-download-control
- - 控制附件下载行为并拦截点击事件
attach-download-control
How to Use
使用方法
Read individual rule files for detailed explanations and code examples:
rules/shared/core/core-provider-setup.md
rules/shared/mode/mode-popover.mdEach rule file contains:
- Brief explanation of why it matters
- Incorrect code example with explanation
- Correct code example with explanation
- Source pointers to official documentation
阅读单个规则文件获取详细说明及代码示例:
rules/shared/core/core-provider-setup.md
rules/shared/mode/mode-popover.md每个规则文件包含:
- 规则重要性的简要说明
- 错误代码示例及问题解释
- 正确代码示例及解释
- 官方文档的参考链接
Compiled Documents
编译文档
- — Compressed index of all rules with file paths (start here)
AGENTS.md - — Full verbose guide with all rules expanded inline
AGENTS.full.md
- — 包含所有规则及文件路径的压缩索引(从这里开始)
AGENTS.md - — 包含所有规则详细内容的完整指南
AGENTS.full.md