Unverified Commit c6c56c80 authored by AUTOMATIC1111's avatar AUTOMATIC1111 Committed by GitHub
Browse files

Merge pull request #6272 from stysmmaker/feat/image-paste-fallback

Add image paste fallback
parents aa44f40c 7c89f371
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -9,11 +9,19 @@ function dropReplaceImage( imgWrap, files ) {
        return;
    }

    const tmpFile = files[0];

    imgWrap.querySelector('.modify-upload button + button, .touch-none + div button + button')?.click();
    const callback = () => {
        const fileInput = imgWrap.querySelector('input[type="file"]');
        if ( fileInput ) {
            if ( files.length === 0 ) {
                files = new DataTransfer();
                files.items.add(tmpFile);
                fileInput.files = files.files;
            } else {
                fileInput.files = files;
            }
            fileInput.dispatchEvent(new Event('change'));   
        }
    };