docs: add privacy guides and link from main docs#1790
docs: add privacy guides and link from main docs#1790
Conversation
Add comprehensive privacy recipe documentation in English and Simplified Chinese, covering masking, blocking, ignoring, and performance considerations. Update privacy-related option references in guide.md and guide.zh_CN.md to point to the new dedicated privacy guides.
|
|
Size Change: 0 B Total Size: 10.1 MB ℹ️ View Unchanged
|
There was a problem hiding this comment.
Pull request overview
Adds dedicated privacy “recipe” guides (EN + Simplified Chinese) and updates the main guides’ option tables to reference these new privacy documents instead of the inline “privacy” sections.
Changes:
- Added new privacy guides under
docs/recipes/in English and Simplified Chinese. - Updated privacy-related option references in
guide.md/guide.zh_CN.mdto link to the new privacy guides.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
| guide.md | Updates several privacy option rows to link to the new privacy guide. |
| guide.zh_CN.md | Updates several privacy option rows to link to the new Chinese privacy guide. |
| docs/recipes/privacy.md | Adds a comprehensive English privacy guide (mask/block/ignore/perf). |
| docs/recipes/privacy.zh_CN.md | Adds a comprehensive Simplified Chinese privacy guide (mask/block/ignore/perf). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| record({ | ||
| emit(event) { | ||
| const endTime = performance.now(); | ||
| console.log(`事件处理时间: ${endTime - startTime}ms`); |
There was a problem hiding this comment.
这个示例计算的是从 startTime 开始到当前的总耗时,并不是单个事件的“处理时间”。如果想测量 emit 回调本身的耗时,应该把 startTime 放到 emit 内部(或调整文案为“自录制开始的累计耗时”)。
| console.log(`事件处理时间: ${endTime - startTime}ms`); | |
| console.log(`自录制开始的累计耗时: ${endTime - startTime}ms`); |
|
|
||
| --- | ||
|
|
||
| ## 总结 |
There was a problem hiding this comment.
这个相对链接路径不正确:从 docs/recipes/privacy.zh_CN.md 出发,../guide.md 指向的是 docs/guide.md(仓库中不存在)。请改为指向仓库根目录的指南(例如 ../../guide.zh_CN.md,或按期望语言指向 ../../guide.md)。
| | blockSelector | null | Use a string to configure which selector should be blocked, refer to the [privacy guide](./docs/recipes/privacy.md) | | ||
| | ignoreClass | 'rr-ignore' | Use a string or RegExp to configure which elements should be ignored, refer to the [privacy guide](./docs/recipes/privacy.md) | | ||
| | ignoreSelector | null | Use a string to configure which selector should be ignored, refer to the [privacy guide](./docs/recipes/privacy.md) | | ||
| | ignoreCSSAttributes | null | array of CSS attributes that should be ignored | |
There was a problem hiding this comment.
ignoreCSSAttributes 在代码中是 Set<string>(见 packages/rrweb/src/types.ts),这里描述成了 “array” 且默认值为 null 容易造成误解。既然本次已经把隐私选项统一指向隐私指南,建议同时把这一行更新为 Set<string>(并可同样加上隐私指南链接以保持一致)。
| | ignoreCSSAttributes | null | array of CSS attributes that should be ignored | | |
| | ignoreCSSAttributes | null | Set<string> of CSS attributes that should be ignored, refer to the [privacy guide](./docs/recipes/privacy.md) | |
guide.zh_CN.md
Outdated
| | ignoreCSSAttributes | null | 应该被忽略的 CSS 属性数组 | | ||
| | maskTextClass | 'rr-mask' | 字符串或正则表达式,可用于自定义忽略元素 text 内容的类名,详见[“隐私”](#隐私)章节 | | ||
| | maskTextClass | 'rr-mask' | 字符串或正则表达式,可用于自定义忽略元素 text 内容的类名,详见[隐私指南](./docs/recipes/privacy.zh_CN.md) | |
There was a problem hiding this comment.
ignoreCSSAttributes 在实现里是 Set<string>,这里写成“CSS 属性数组”会误导;另外 maskTextClass 是“遮蔽/屏蔽”文本而不是“忽略”。建议将 ignoreCSSAttributes 的描述改为 Set<string>,并把 maskTextClass 的文案从“忽略”改为“遮蔽/屏蔽”。
| ]), | ||
|
|
||
| // Masking | ||
| maskAllInputs: true, | ||
| maskInputOptions: { |
There was a problem hiding this comment.
ignoreCSSAttributes is for CSS property names from CSSStyleDeclaration (e.g. color, border-color). This example uses data-* values (data-user-id, etc.), which will never match and is misleading. Replace these with actual CSS properties (or remove this line from the example) and, if you want to recommend excluding DOM attributes, document the appropriate option for that instead.
| record({ | ||
| emit(event) { | ||
| const endTime = performance.now(); | ||
| console.log(`Event processing time: ${endTime - startTime}ms`); |
There was a problem hiding this comment.
The timing example measures elapsed time since startTime, not “event processing time” per event. If the intent is to measure handler duration, move startTime inside emit (or rename the log/message to reflect that it is total elapsed time since recording started).
| console.log(`Event processing time: ${endTime - startTime}ms`); | |
| console.log(`Elapsed time since recording started: ${endTime - startTime}ms`); |
|
|
||
| --- | ||
|
|
||
| ## Summary |
There was a problem hiding this comment.
This relative link is broken: from docs/recipes/privacy.md, ../guide.md points to docs/guide.md (which doesn’t exist). Update it to the correct path to the repo-root guide (e.g. ../../guide.md).
| ]), | ||
|
|
||
| // 遮蔽 | ||
| maskAllInputs: true, | ||
| maskInputOptions: { |
There was a problem hiding this comment.
ignoreCSSAttributes 用于忽略 CSSStyleDeclaration 的 CSS 属性名(例如 color、border-color)。这里示例里写的是 data-user-id / data-session-id / data-analytics 这类 data-*,不会匹配任何 CSS 属性,容易误导。建议改成真实的 CSS 属性名或移除该行;若想说明忽略 DOM 属性,需要另行说明对应的配置项。
Add comprehensive privacy recipe documentation in English and Simplified Chinese, covering masking, blocking, ignoring, and performance considerations.
Update privacy-related option references in guide.md and guide.zh_CN.md to point to the new dedicated privacy guides.