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;
|
return ta.selectionEnd = ta.selectionStart = caretPos + text.length;
|
||||||
},
|
},
|
||||||
fileDrop: function(e) {
|
fileDrop: function(e) {
|
||||||
if (!e.dataTransfer.files.length) return;
|
if (/TEXTAREA|INPUT/.test(e.target.nodeName)) return;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
e.dataTransfer.dropEffect = 'copy';
|
e.dataTransfer.dropEffect = 'copy';
|
||||||
if (e.type === 'drop') {
|
if (e.type === 'drop') {
|
||||||
|
if (!e.dataTransfer.files.length) return;
|
||||||
qr.open();
|
qr.open();
|
||||||
qr.fileInput.call(e.dataTransfer);
|
qr.fileInput.call(e.dataTransfer);
|
||||||
return $.addClass(qr.el, 'dump');
|
return $.addClass(qr.el, 'dump');
|
||||||
|
|||||||
@ -881,8 +881,8 @@ qr =
|
|||||||
if conf['Persistent QR']
|
if conf['Persistent QR']
|
||||||
qr.dialog()
|
qr.dialog()
|
||||||
$.id('autohide').click() if conf['Auto Hide QR']
|
$.id('autohide').click() if conf['Auto Hide QR']
|
||||||
$.on d, 'dragover', qr.fileDrop
|
$.on d, 'dragover', qr.fileDrop
|
||||||
$.on d, 'drop', qr.fileDrop
|
$.on d, 'drop', qr.fileDrop
|
||||||
|
|
||||||
open: ->
|
open: ->
|
||||||
if qr.el
|
if qr.el
|
||||||
@ -933,11 +933,12 @@ qr =
|
|||||||
ta.selectionEnd = ta.selectionStart = caretPos + text.length
|
ta.selectionEnd = ta.selectionStart = caretPos + text.length
|
||||||
|
|
||||||
fileDrop: (e) ->
|
fileDrop: (e) ->
|
||||||
return unless e.dataTransfer.files.length # let it only drop files
|
return if /TEXTAREA|INPUT/.test e.target.nodeName
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
e.dataTransfer.dropEffect = 'copy' # cursor feedback
|
e.dataTransfer.dropEffect = 'copy' # cursor feedback
|
||||||
if e.type is 'drop'
|
if e.type is 'drop'
|
||||||
|
return unless e.dataTransfer.files.length # let it only drop files
|
||||||
qr.open()
|
qr.open()
|
||||||
qr.fileInput.call e.dataTransfer
|
qr.fileInput.call e.dataTransfer
|
||||||
$.addClass qr.el, 'dump'
|
$.addClass qr.el, 'dump'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user