1

I'm trying to handle copy & paste for images similar to drag & drop in PrimeFaces

I'm handling paste and then pass the files to remote command, but I'm receiving only strings

         window.onload = function() {
                console.log("paste!!");
             const upldFile = document.getElementById('upld');
             upldFile.onpaste = function(e) {
                 console.log("paste");
                 var items = e.clipboardData.items;
                    console.log(items);
                    if(items != undefined){                 
                        handlePaste([{name: 'data', value: JSON.stringify(items) }]);// a call to remote commend
                        }
             }
            }


JSF 2.2
Primefaces 7

Melloware
  • 10,435
  • 2
  • 32
  • 62
  • 1
    This isn't a PrimeFaces question its a Javascript question: https://stackoverflow.com/questions/490908/paste-an-image-from-clipboard-using-javascripthttps://stackoverflow.com/questions/490908/paste-an-image-from-clipboard-using-javascript – Melloware Mar 29 '20 at 12:07
  • 1
    and there is nothing jsf-2.2 specific in the question, not even jsf in general – Kukeltje Mar 29 '20 at 12:52
  • I'm trying to add Copy & Paste Support for Images in Primefaces fileupload – Muhammad Nabil Mar 29 '20 at 13:52
  • Yep by PF upload is just Jquery FileUpload under the covers: https://github.com/blueimp/jQuery-File-Upload which is pure Javascript – Melloware Mar 29 '20 at 14:26

0 Answers0