danielm / uploader

A lightweight and very configurable jQuery plugin for file uploading using ajax(a sync); includes support for queues, progress tracking and drag and drop.
https://danielmg.org/demo/java-script/uploader
MIT License
1.17k stars 385 forks source link

Support pasting from clipboard #107

Open yusanshi opened 4 years ago

yusanshi commented 4 years ago

Add support for getting image from clipboard (For example, use Windows+Shift+S to capture a screenshot then Ctrl+V in the website). Test OK on Chrome 78. Not working on Microsoft Edge.

ZARk-be commented 4 years ago

please disable your auto-code-format function. I was curious to see the code needed to do that, but there's so much diff because you add spaces before brackets etc...

yusanshi commented 4 years ago

Well it's my fault ... 😅😅 Fixed now.

Schaidhauer commented 4 years ago

A tip if you want to preview the image after the 'paste' event:

onNewFile: function(id, file) { if ((file.type == 'image/png') || (file.type == 'image/jpg') || (file.type == 'image/jpge')) { $('').attr('src', window.URL.createObjectURL(file)).width('100px').height('100px').appendTo($('#drag-and-drop-zone')); }}