Project

General

Profile

Task #1042

Feature #1031: New front-end using SimpleXML

Wire-up importing to lookup editor

Added by Luke Murphey over 8 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Start date:
09/04/2015
Due date:
% Done:

100%


drop_ui.png View (65.6 KB) Luke Murphey, 09/19/2015 04:15 AM

History

#1 Updated by Luke Murphey over 8 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 over 8 years ago

It appears that I cannot hook the drop handler.

#4 Updated by Luke Murphey over 8 years ago

It appears ondrop is available:

var div = document.createElement('div');
div.ondrop // exists

#5 Updated by Luke Murphey over 8 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 over 8 years ago

Might need to be in contentEditable mode (http://help.dottoro.com/ljbflwps.php)

#9 Updated by Luke Murphey over 8 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 over 8 years ago

on drop is working but isn't including the file object.

#11 Updated by Luke Murphey over 8 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;
    };

#12 Updated by Luke Murphey over 8 years ago

#15 Updated by Luke Murphey over 8 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

#16 Updated by Luke Murphey over 8 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

Also available in: Atom PDF