Drag and drop fixes, let it drop text into text inputs. It won't let it drop files into text inputs though.
This commit is contained in:
parent
962e9d301d
commit
84057f65c1
@ -1265,11 +1265,12 @@
|
||||
return ta.selectionEnd = ta.selectionStart = caretPos + text.length;
|
||||
},
|
||||
fileDrop: function(e) {
|
||||
if (!e.dataTransfer.files.length) return;
|
||||
if (/TEXTAREA|INPUT/.test(e.target.nodeName)) return;
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
e.dataTransfer.dropEffect = 'copy';
|
||||
if (e.type === 'drop') {
|
||||
if (!e.dataTransfer.files.length) return;
|
||||
qr.open();
|
||||
qr.fileInput.call(e.dataTransfer);
|
||||
return $.addClass(qr.el, 'dump');
|
||||
|
||||
@ -881,8 +881,8 @@ qr =
|
||||
if conf['Persistent QR']
|
||||
qr.dialog()
|
||||
$.id('autohide').click() if conf['Auto Hide QR']
|
||||
$.on d, 'dragover', qr.fileDrop
|
||||
$.on d, 'drop', qr.fileDrop
|
||||
$.on d, 'dragover', qr.fileDrop
|
||||
$.on d, 'drop', qr.fileDrop
|
||||
|
||||
open: ->
|
||||
if qr.el
|
||||
@ -933,11 +933,12 @@ qr =
|
||||
ta.selectionEnd = ta.selectionStart = caretPos + text.length
|
||||
|
||||
fileDrop: (e) ->
|
||||
return unless e.dataTransfer.files.length # let it only drop files
|
||||
return if /TEXTAREA|INPUT/.test e.target.nodeName
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
e.dataTransfer.dropEffect = 'copy' # cursor feedback
|
||||
if e.type is 'drop'
|
||||
return unless e.dataTransfer.files.length # let it only drop files
|
||||
qr.open()
|
||||
qr.fileInput.call e.dataTransfer
|
||||
$.addClass qr.el, 'dump'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user