mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-28 21:42:27 +08:00
fix: prevent backspace from deleting files when text contains whitespace (#10261)
- Change condition from text.trim() === '' to text.length === 0 - Users can now delete whitespace characters (spaces, tabs, newlines) without accidentally deleting attached files - File deletion only occurs when text is completely empty - Maintains existing functionality for file deletion when text is truly empty Fixes: Blank character input causes backspace to incorrectly delete attached images Signed-off-by: zhaokun <zhaokun_zhang@icloud.com>
This commit is contained in:
parent
63be1d8cf2
commit
1e615d69e1
@ -377,7 +377,7 @@ const Inputbar: FC<Props> = ({ assistant: _assistant, setActiveTopic, topic }) =
|
||||
}
|
||||
}
|
||||
|
||||
if (event.key === 'Backspace' && text.trim() === '' && files.length > 0) {
|
||||
if (event.key === 'Backspace' && text.length === 0 && files.length > 0) {
|
||||
setFiles((prev) => prev.slice(0, -1))
|
||||
return event.preventDefault()
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user