Bind for file-based DOM events in fileManager, not in command.

This commit is contained in:
Thomas Wilburn 2014-01-12 01:26:37 -08:00
parent d26797ca80
commit 99e7ce8e8d
2 changed files with 11 additions and 10 deletions

View file

@ -77,16 +77,6 @@ define([
}
});
document.body.on("dragover", function(e) {
e.preventDefault();
});
document.body.on("drop", function(e) {
e.preventDefault();
if (e.dataTransfer.types.indexOf("Files") === -1) return;
fire("session:open-dragdrop", e.dataTransfer.items);
});
//register for startup and fire any commands that are pending
register("init:startup", function() {
if (window.launchCommands) {

View file

@ -60,8 +60,19 @@ define([
}
});
};
document.body.on("dragover", function(e) {
e.preventDefault();
});
document.body.on("drop", function(e) {
e.preventDefault();
if (e.dataTransfer.types.indexOf("Files") === -1) return;
fire("session:open-dragdrop", e.dataTransfer.items);
});
command.on("session:open-dragdrop", openFromDropEvent);
command.on("session:new-file", function(content) { return sessions.addFile(content) });
command.on("session:open-file", openFile);
command.on("session:save-file", function(c) { sessions.getCurrent().save(c) });