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

feat: Sender support pasteFile #184

Merged
merged 4 commits into from
Nov 7, 2024
Merged

feat: Sender support pasteFile #184

merged 4 commits into from
Nov 7, 2024

Conversation

zombieJ
Copy link
Member

@zombieJ zombieJ commented Nov 6, 2024

Summary by CodeRabbit

  • 新功能

    • 增加了对粘贴文件和图像的支持,提升了附件上传的灵活性。
    • SenderHeader 组件新增 forceRender 属性,增强渲染控制。
    • Attachments 组件引入了 AttachmentsRef 接口,提供文件上传和原生元素访问功能。
  • 文档

    • 更新了 API 文档,新增了 AttachmentsRefforceRender 属性的说明。
    • 添加了粘贴图像的示例,增强了用户指导材料。

Copy link
Contributor

coderabbitai bot commented Nov 6, 2024

📝 Walkthrough

Walkthrough

本次变更涉及多个组件的修改,主要集中在附件和发送器功能的增强。FileListCard 组件的图像预览逻辑得到了改善,PlaceholderUploaderSilentUploader 组件引入了对 ref 的支持,以便更好地处理文件上传。Attachments 组件增加了新的引用类型和上传方法,提供了更灵活的 API。Sender 组件则新增了处理粘贴事件的功能,同时更新了文档以反映这些变化。

Changes

文件路径 变更摘要
components/attachments/FileListCard.tsx 修改图像预览逻辑,从检查 previewUrl 改为检查 item.originFileObj,并更新了图像源的使用方式。
components/attachments/PlaceholderUploader.tsx 更新 Placeholder 函数签名,调整 ref 参数类型并将其传递给 Upload.Dragger 组件。
components/attachments/SilentUploader.tsx 添加 ref 参数,支持 forwardRef,并通过 useImperativeHandle 使父组件能够访问 Upload 实例。
components/attachments/index.en-US.md 新增 AttachmentsRef 部分,定义 nativeElementupload 方法,未修改现有属性。
components/attachments/index.tsx 新增 AttachmentsRef 接口,更新 Attachments 函数签名以支持 ref,并修改导出为 ForwardAttachments
components/attachments/index.zh-CN.md 新增 AttachmentsRef 部分,定义 nativeElementupload 方法,未修改现有属性。
components/attachments/style/fileCard.ts 修改 CSS 选择器以提高特异性,确保样式正确应用于删除图标。
components/sender/SenderHeader.tsx SenderHeaderProps 接口中添加可选属性 forceRender,用于控制组件的渲染行为。
components/sender/demo/paste-image.md 新增中英文部分,描述粘贴文件上传功能。
components/sender/demo/paste-image.tsx 新增 Demo 组件,集成 SenderAttachments 组件,管理文件上传的用户界面。
components/sender/index.en-US.md 在示例部分新增粘贴图像的演示,并更新 Sender.Header 的 API 文档以包含 forceRender 属性。
components/sender/index.tsx SenderProps 接口中新增 onPasteonPasteFile 属性,增强组件的粘贴事件处理能力。
components/sender/index.zh-CN.md 更新文档,新增粘贴图像的示例,并在 API 部分添加 forceRender 属性,调整表格格式以提高清晰度。

Poem

在兔子洞里欢声笑,
文件上传真是妙。
拖拽轻松不费力,
预览图像笑嘻嘻。
新功能来助力,
兔子开心乐无比! 🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 01f4540 and 03dd5cf.

⛔ Files ignored due to path filters (4)
  • components/attachments/__tests__/__snapshots__/demo-extend.test.ts.snap is excluded by !**/*.snap
  • components/attachments/__tests__/__snapshots__/demo.test.tsx.snap is excluded by !**/*.snap
  • components/sender/__tests__/__snapshots__/demo-extend.test.ts.snap is excluded by !**/*.snap
  • components/sender/__tests__/__snapshots__/demo.test.ts.snap is excluded by !**/*.snap
📒 Files selected for processing (13)
  • components/attachments/FileList/FileListCard.tsx (1 hunks)
  • components/attachments/PlaceholderUploader.tsx (3 hunks)
  • components/attachments/SilentUploader.tsx (2 hunks)
  • components/attachments/index.en-US.md (1 hunks)
  • components/attachments/index.tsx (7 hunks)
  • components/attachments/index.zh-CN.md (1 hunks)
  • components/attachments/style/fileCard.ts (1 hunks)
  • components/sender/SenderHeader.tsx (3 hunks)
  • components/sender/demo/paste-image.md (1 hunks)
  • components/sender/demo/paste-image.tsx (1 hunks)
  • components/sender/index.en-US.md (2 hunks)
  • components/sender/index.tsx (4 hunks)
  • components/sender/index.zh-CN.md (2 hunks)

Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

github-actions bot commented Nov 6, 2024

Preview is ready

Copy link

cloudflare-workers-and-pages bot commented Nov 6, 2024

Deploying ant-design-x with  Cloudflare Pages  Cloudflare Pages

Latest commit: 03dd5cf
Status: ✅  Deploy successful!
Preview URL: https://b6e3ca8f.ant-design-x.pages.dev
Branch Preview URL: https://paste.ant-design-x.pages.dev

View logs

@zombieJ zombieJ marked this pull request as ready for review November 7, 2024 02:43
Copy link
Collaborator

@YumoImer YumoImer left a comment

Choose a reason for hiding this comment

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

+1

@zombieJ zombieJ merged commit bdc8d30 into main Nov 7, 2024
9 checks passed
@zombieJ zombieJ deleted the paste branch November 7, 2024 02:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants