mirror of
https://github.com/kyantech/Palmr.git
synced 2025-10-23 06:11:58 +00:00
fix(web): paste functionality in input fields except password inputs (#286)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: danielalves96 <62755605+danielalves96@users.noreply.github.com>
This commit is contained in:
@@ -243,8 +243,13 @@ export function GlobalDropZone({ onSuccess, children, currentFolderId }: GlobalD
|
||||
|
||||
const handlePaste = useCallback(
|
||||
(event: ClipboardEvent) => {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
const target = event.target as HTMLElement;
|
||||
const isInput = target.tagName === "INPUT" || target.tagName === "TEXTAREA";
|
||||
const isPasswordInput = target.tagName === "INPUT" && (target as HTMLInputElement).type === "password";
|
||||
|
||||
if (isInput && !isPasswordInput) {
|
||||
return;
|
||||
}
|
||||
|
||||
const items = event.clipboardData?.items;
|
||||
if (!items) return;
|
||||
@@ -253,6 +258,9 @@ export function GlobalDropZone({ onSuccess, children, currentFolderId }: GlobalD
|
||||
|
||||
if (imageItems.length === 0) return;
|
||||
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
const newUploads: FileUpload[] = [];
|
||||
|
||||
imageItems.forEach((item) => {
|
||||
|
Reference in New Issue
Block a user