@@ -669,6 +669,18 @@ function submitFiles(allFiles) {
669
669
}
670
670
allSucceeded = false ;
671
671
}
672
+ if ( file . isClipboard ) {
673
+ setTimeout ( ( ) => {
674
+ window . selectedFiles = [ ] ;
675
+ updateFileInfoCount ( ) ;
676
+ const progressContainer = document . getElementById ( "uploadProgressContainer" ) ;
677
+ if ( progressContainer ) progressContainer . innerHTML = "" ;
678
+ const fileInfoContainer = document . getElementById ( "fileInfoContainer" ) ;
679
+ if ( fileInfoContainer ) {
680
+ fileInfoContainer . innerHTML = `<span id="fileInfoDefault">No files selected</span>` ;
681
+ }
682
+ } , 5000 ) ;
683
+ }
672
684
673
685
// ─── Only now count this chunk as finished ───────────────────
674
686
finishedCount ++ ;
@@ -847,4 +859,39 @@ function initUpload() {
847
859
}
848
860
}
849
861
850
- export { initUpload } ;
862
+ export { initUpload } ;
863
+
864
+ // -------------------------
865
+ // Clipboard Paste Handler (Mimics Drag-and-Drop)
866
+ // -------------------------
867
+ document . addEventListener ( 'paste' , function handlePasteUpload ( e ) {
868
+ const items = e . clipboardData ?. items ;
869
+ if ( ! items ) return ;
870
+
871
+ const files = [ ] ;
872
+
873
+ for ( let i = 0 ; i < items . length ; i ++ ) {
874
+ const item = items [ i ] ;
875
+ if ( item . kind === 'file' ) {
876
+ const file = item . getAsFile ( ) ;
877
+ if ( file ) {
878
+ const ext = file . name . split ( '.' ) . pop ( ) || 'png' ;
879
+ const renamedFile = new File ( [ file ] , `image${ Date . now ( ) } .${ ext } ` , { type : file . type } ) ;
880
+ renamedFile . isClipboard = true ;
881
+
882
+ Object . defineProperty ( renamedFile , 'customRelativePath' , {
883
+ value : renamedFile . name ,
884
+ writable : true ,
885
+ configurable : true
886
+ } ) ;
887
+
888
+ files . push ( renamedFile ) ;
889
+ }
890
+ }
891
+ }
892
+
893
+ if ( files . length > 0 ) {
894
+ processFiles ( files ) ;
895
+ showToast ( 'Pasted file added to upload list.' , 'success' ) ;
896
+ }
897
+ } ) ;
0 commit comments