-
-
Notifications
You must be signed in to change notification settings - Fork 10.6k
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
🐛 fix: dragging text mistakenly as image #2111
Conversation
@sxjeru is attempting to deploy a commit to the LobeHub Team on Vercel. A member of the Team first needs to authorize it. |
👍 @sxjeru Thank you for raising your pull request and contributing to our Community |
CI 挂了,merge 下 main |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2111 +/- ##
=======================================
Coverage 92.88% 92.88%
=======================================
Files 302 302
Lines 17643 17643
Branches 1273 1273
=======================================
Hits 16388 16388
Misses 1255 1255 ☔ View full report in Codecov by Sentry. |
@sxjeru 录个 before 和 after 的视频做个示意吧? |
Hold on. |
展开视频before.mp4after.mp4虽然视频中用的是 file:///,但效果与网页图片一样。 另外往里拖本地文件或图片,依旧都会显示“上传图片”的 overlay 提示。 |
能做到其他网页拖入的图片,仍然和之前的展示一样不?我觉得为了文字部分能拖动而牺牲图片拖动的展示,感觉不太合适。 |
Can pictures dragged from other web pages still be displayed the same as before? I don’t think it’s appropriate to sacrifice the dragging of images for the sake of dragging text. |
这可能很难,因为 dragenter 时无法获取拖拽内容的 html,光靠 kind 与 type 不能区分 text 与 image。 兹认为一般逻辑也是图片拖动到文本框即上传。(例如 Github) |
This may be difficult because the html of the dragged content cannot be obtained during dragenter, and text and image cannot be distinguished by kind and type alone. |
已实现需求。 |
Requirements realized. |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
有录屏吗?为啥我试了下好像不行呢 |
Is there any screen recording? Why doesn't it seem to work when I try it? |
刚刚用上面的 Preview 构建再试了一次(拖拽网页图片),是可以的。 当然拖拽 lobehub 自己页内的头像图片等是无效的,需要其他网页的图片。 |
I just tried it again using the Preview build above (drag and drop web images), and it works. |
@sxjeru 那我这个操作有问题么?试下来是无效的 Area.mp4 |
排查了一会,需要把浮于下方的 Vercel Bar 禁用才行。(Preview 构建特有,Vercel 自带) |
既然目前确认只有拖拽内容中的 Files 被上传,应当把文字拖拽扩展到所有浏览器。 |
Since it is currently confirmed that only the Files in the dragged content are uploaded, text dragging should be extended to all browsers. |
src/app/(main)/chat/(desktop)/features/ChatInput/Footer/DragUpload.tsx
Outdated
Show resolved
Hide resolved
@sxjeru 麻烦 rebase 下,然后我再构建下最后看一眼 |
@sxjeru Please rebase, and then I will build it and take a final look. |
ok 了,之前的 preview 测试了 win 的 chrome 与 Firefox,行为达成预期,应该可以合并了。 |
OK, the previous preview tested Win's Chrome and Firefox, the behavior is as expected, and it should be possible to merge. |
删掉吧 |
Delete it |
❤️ Great PR @sxjeru ❤️ The growth of project is inseparable from user feedback and contribution, thanks for your contribution! If you are interesting with the lobehub developer community, please join our discord and then dm @arvinxx or @canisminor1990. They will invite you to our private developer channel. We are talking about the lobe-chat development or sharing ai newsletter around the world. |
### [Version 0.159.2](v0.159.1...v0.159.2) <sup>Released on **2024-05-14**</sup> #### 🐛 Bug Fixes - **misc**: Dragging text mistakenly as image. <br/> <details> <summary><kbd>Improvements and Fixes</kbd></summary> #### What's fixed * **misc**: Dragging text mistakenly as image, closes [#2111](#2111) ([3c047ef](3c047ef)) </details> <div align="right"> [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top) </div>
🎉 This PR is included in version 0.159.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
## [Version 1.39.0](v1.38.1...v1.39.0) <sup>Released on **2024-05-14**</sup> #### ♻ Code Refactoring - **misc**: Move next-auth hooks to user store actions. #### ✨ Features - **misc**: Support DeepSeek as new model provider. #### 🐛 Bug Fixes - **misc**: Dragging text mistakenly as image, pin `[email protected]` to fix build error. <br/> <details> <summary><kbd>Improvements and Fixes</kbd></summary> #### Code refactoring * **misc**: Move next-auth hooks to user store actions, closes [lobehub#2364](https://github.com/bentwnghk/lobe-chat/issues/2364) ([6dbcd70](6dbcd70)) #### What's improved * **misc**: Support DeepSeek as new model provider, closes [lobehub#2446](https://github.com/bentwnghk/lobe-chat/issues/2446) ([18028f3](18028f3)) #### What's fixed * **misc**: Dragging text mistakenly as image, closes [lobehub#2111](https://github.com/bentwnghk/lobe-chat/issues/2111) ([3c047ef](3c047ef)) * **misc**: Pin `[email protected]` to fix build error, closes [lobehub#2483](https://github.com/bentwnghk/lobe-chat/issues/2483) ([aa03833](aa03833)) </details> <div align="right"> [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top) </div>
### [Version 0.159.2](lobehub/lobe-chat@v0.159.1...v0.159.2) <sup>Released on **2024-05-14**</sup> #### 🐛 Bug Fixes - **misc**: Dragging text mistakenly as image. <br/> <details> <summary><kbd>Improvements and Fixes</kbd></summary> #### What's fixed * **misc**: Dragging text mistakenly as image, closes [lobehub#2111](lobehub#2111) ([3c047ef](lobehub@3c047ef)) </details> <div align="right"> [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top) </div>
### [Version 0.159.2](lobehub/lobe-chat@v0.159.1...v0.159.2) <sup>Released on **2024-05-14**</sup> #### 🐛 Bug Fixes - **misc**: Dragging text mistakenly as image. <br/> <details> <summary><kbd>Improvements and Fixes</kbd></summary> #### What's fixed * **misc**: Dragging text mistakenly as image, closes [lobehub#2111](lobehub#2111) ([3c047ef](lobehub@3c047ef)) </details> <div align="right"> [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top) </div>
💻 变更类型 | Change Type
🔀 变更说明 | Description of Change
原本使用
支持上传图片或文件的模型
时,不论拖入任何元素,还是拖动聊天时的文字,都会出现“上传图片”提示页,导致无法将拖拽的文字插入聊天框。本修改使得拖拽上传只对本地文件生效。
特别的,当拖拽网页图片时,不会出现“上传图片”提示页。但拖拽到文本框后松开,能正常附上图片。
📝 补充信息 | Additional Information
不知是否需要公开 vercel 部署供验证,本人已测试多种情况,应当无异常。