Skip to content
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

Merged
merged 2 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions components/sender/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 | - | - |

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.


```typescript | pure
type SpeechConfig = {
Expand Down
1 change: 1 addition & 0 deletions components/sender/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 | - | - |

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

确保在组件逻辑中正确实现onPasteFile回调,以有效处理文件粘贴事件。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

建议完善 onPasteFile 回调的文档说明

当前文档对 onPasteFile 回调的说明过于简单。建议补充以下内容:

  1. 支持的文件类型说明
  2. paste-image.tsx 示例的关联说明
  3. 与普通的 onPaste 事件的区别
  4. 使用场景和最佳实践

建议更新为:

-| 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.

Suggested change
| onPasteFile | 黏贴文件的回调 | (file: File) => void | - | - |
| onPasteFile | 黏贴文件的回调,用于处理用户通过剪贴板粘贴的文件(如图片)。可以配合 `paste-image.tsx` 示例了解具体用法。注意:普通文本的粘贴事件请使用 `onPaste` 处理。 | (file: File) => void | - | - |


```typescript | pure
type SpeechConfig = {
Expand Down
Loading