Task #1042
Feature #1031: New front-end using SimpleXML
Wire-up importing to lookup editor
Start date:
09/04/2015
Due date:
% Done:
100%
History
#1 Updated by Luke Murphey about 9 years ago
Drag and dropping is not going well.
var dropZone = document.getElementById('lookups_editor') dropZone.addEventListener('drop', function(evt){console.log("got it");}, false);
#2 Updated by Luke Murphey about 9 years ago
It appears that I cannot hook the drop handler.
#4 Updated by Luke Murphey about 9 years ago
It appears ondrop is available:
var div = document.createElement('div'); div.ondrop // exists
#5 Updated by Luke Murphey about 9 years ago
This doesn't work either:
var dropzone = document.getElementById('drop-zone'); // exists dropzone.drop = function(){ console.log("Droppin da filez"); }
#6 Updated by Luke Murphey about 9 years ago
Might need to be in contentEditable mode (http://help.dottoro.com/ljbflwps.php)
#8 Updated by Luke Murphey about 9 years ago
Working example: http://plnkr.co/edit/2mW3NR0QBuPI59sDEDRo?p=preview
#9 Updated by Luke Murphey about 9 years ago
This works?!:
var holder = document.getElementById('drop-zone'); console.dir(holder) holder.ondragenter = function (e) { e.preventDefault(); this.className = 'nicenice lvl-over'; return false; }; holder.ondragleave = function () { this.className = 'nicenice'; return false; }; holder.ondragover = function (e) { e.preventDefault() } holder.ondrop = function (e) { e.preventDefault(); console.log("GOT DROP EVENT"); alert("dropped here"); return false; };
#10 Updated by Luke Murphey about 9 years ago
on drop is working but isn't including the file object.
#11 Updated by Luke Murphey about 9 years ago
This works:
var holder = document.getElementById('drop-zone'); console.dir(holder) holder.ondragenter = function (e) { e.preventDefault(); return false; }; holder.ondragleave = function () { return false; }; holder.ondragover = function (e) { e.preventDefault(); e.dataTransfer.dropEffect = 'copy'; } holder.ondrop = function (e) { e.preventDefault(); console.log("GOT DROP EVENT"); alert(e.dataTransfer.files.length); return false; };
#15 Updated by Luke Murphey about 9 years ago
- Status changed from New to Closed
- % Done changed from 0 to 100
#16 Updated by Luke Murphey about 9 years ago
For some reason wiring up the drag handlers using Backbone and jQuery never works:
var ondrop = function (e) { e.preventDefault(); this.onDropFile(e); return false; }.bind(this); var ondragover = function (e) { e.preventDefault(); e.dataTransfer.dropEffect = 'copy'; }.bind(this); $("#lookup-table") .on("dragover", ondragover) .on("drop", ondrop);
I get an error indicating that:
Uncaught TypeError: Cannot set property 'dropEffect' of undefined Uncaught TypeError: Cannot read property 'files' of undefined