-
-
Notifications
You must be signed in to change notification settings - Fork 217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs(sender): add onPasteFile callback #495
Conversation
📝 Walkthrough概览遍历此拉取请求为 变更
可能相关的 PR
诗歌
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Walkthrough此PR更新了Sender组件文档,添加了 Changes
|
@@ -52,6 +52,7 @@ Common props ref:[Common props](/docs/react/common-props) | |||
| onSubmit | Callback when click send button | (message: string) => void | - | - | | |||
| onChange | Callback when input value changes | (value: string, event?: React.FormEvent<`HTMLTextAreaElement`> \| React.ChangeEvent<`HTMLTextAreaElement`> ) => void | - | - | | |||
| onCancel | Callback when click cancel button | () => void | - | - | | |||
| onPasteFile | Callback when paste file | (file: File) => void | - | - | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure that the onPasteFile
callback is properly implemented in the component logic to handle file pasting events effectively.
@@ -53,6 +53,7 @@ coverDark: https://mdn.alipayobjects.com/huamei_iwk9zp/afts/img/A*cOfrS4fVkOMAAA | |||
| onSubmit | 点击发送按钮的回调 | (message: string) => void | - | - | | |||
| onChange | 输入框值改变的回调 | (value: string, event?: React.FormEvent<`HTMLTextAreaElement`> \| React.ChangeEvent<`HTMLTextAreaElement`> ) => void | - | - | | |||
| onCancel | 点击取消按钮的回调 | () => void | - | - | | |||
| onPasteFile | 黏贴文件的回调 | (file: File) => void | - | - | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
确保在组件逻辑中正确实现onPasteFile
回调,以有效处理文件粘贴事件。
Bundle ReportBundle size has no change ✅ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
components/sender/index.en-US.md
(1 hunks)components/sender/index.zh-CN.md
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: test / react component workflow
- GitHub Check: build preview
- GitHub Check: size
🔇 Additional comments (1)
components/sender/index.en-US.md (1)
55-55
: 建议完善英文文档中onPasteFile
回调的说明英文文档中的说明同样需要补充。建议与中文文档保持一致,更新为:
-| onPasteFile | Callback when paste file | (file: File) => void | - | - | +| onPasteFile | Callback triggered when a file (e.g., image) is pasted from clipboard. See `paste-image.tsx` demo for usage example. Note: For regular text paste events, use `onPaste` instead. | (file: File) => void | - | - |
@@ -53,6 +53,7 @@ coverDark: https://mdn.alipayobjects.com/huamei_iwk9zp/afts/img/A*cOfrS4fVkOMAAA | |||
| onSubmit | 点击发送按钮的回调 | (message: string) => void | - | - | | |||
| onChange | 输入框值改变的回调 | (value: string, event?: React.FormEvent<`HTMLTextAreaElement`> \| React.ChangeEvent<`HTMLTextAreaElement`> ) => void | - | - | | |||
| onCancel | 点击取消按钮的回调 | () => void | - | - | | |||
| onPasteFile | 黏贴文件的回调 | (file: File) => void | - | - | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
建议完善 onPasteFile
回调的文档说明
当前文档对 onPasteFile
回调的说明过于简单。建议补充以下内容:
- 支持的文件类型说明
- 与
paste-image.tsx
示例的关联说明 - 与普通的
onPaste
事件的区别 - 使用场景和最佳实践
建议更新为:
-| onPasteFile | 黏贴文件的回调 | (file: File) => void | - | - |
+| onPasteFile | 黏贴文件的回调,用于处理用户通过剪贴板粘贴的文件(如图片)。可以配合 `paste-image.tsx` 示例了解具体用法。注意:普通文本的粘贴事件请使用 `onPaste` 处理。 | (file: File) => void | - | - |
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| onPasteFile | 黏贴文件的回调 | (file: File) => void | - | - | | |
| onPasteFile | 黏贴文件的回调,用于处理用户通过剪贴板粘贴的文件(如图片)。可以配合 `paste-image.tsx` 示例了解具体用法。注意:普通文本的粘贴事件请使用 `onPaste` 处理。 | (file: File) => void | - | - | |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #495 +/- ##
=======================================
Coverage 91.45% 91.45%
=======================================
Files 67 67
Lines 1462 1462
Branches 370 370
=======================================
Hits 1337 1337
Misses 125 125 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
感谢贡献!
Sender 组件文档 粘贴图片 Demo 中使用了
onPasteFile
回调,但缺少该回调的说明,故补上另外
发现缺少
onPaste
回调的说明,在一些场景下可能需要该回调,例如:用户在输入框粘贴一段网址,希望能够解析地址。
是否可以将
onPaste
回调暴露给组件使用者?Summary by CodeRabbit
onPasteFile
属性,支持在组件中处理文件粘贴操作