mirror of
https://github.com/kyantech/Palmr.git
synced 2025-10-23 16:14:18 +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(
|
const handlePaste = useCallback(
|
||||||
(event: ClipboardEvent) => {
|
(event: ClipboardEvent) => {
|
||||||
event.preventDefault();
|
const target = event.target as HTMLElement;
|
||||||
event.stopPropagation();
|
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;
|
const items = event.clipboardData?.items;
|
||||||
if (!items) return;
|
if (!items) return;
|
||||||
@@ -253,6 +258,9 @@ export function GlobalDropZone({ onSuccess, children, currentFolderId }: GlobalD
|
|||||||
|
|
||||||
if (imageItems.length === 0) return;
|
if (imageItems.length === 0) return;
|
||||||
|
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
|
||||||
const newUploads: FileUpload[] = [];
|
const newUploads: FileUpload[] = [];
|
||||||
|
|
||||||
imageItems.forEach((item) => {
|
imageItems.forEach((item) => {
|
||||||
|
Reference in New Issue
Block a user