Skip to content

Commit

Permalink
The paste event is completely inactive now.
Browse files Browse the repository at this point in the history
  • Loading branch information
enyo committed Jan 22, 2014
1 parent ce87fa1 commit 6b94cd1
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 64 deletions.
31 changes: 5 additions & 26 deletions downloads/dropzone-amd-module.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ function mixin(obj) {
* @api public
*/

Emitter.prototype.on =
Emitter.prototype.addEventListener = function(event, fn){
Emitter.prototype.on = function(event, fn){
this._callbacks = this._callbacks || {};
(this._callbacks[event] = this._callbacks[event] || [])
.push(fn);
Expand All @@ -78,7 +77,7 @@ Emitter.prototype.once = function(event, fn){
fn.apply(this, arguments);
}

on.fn = fn;
fn._off = on;
this.on(event, on);
return this;
};
Expand All @@ -95,17 +94,8 @@ Emitter.prototype.once = function(event, fn){

Emitter.prototype.off =
Emitter.prototype.removeListener =
Emitter.prototype.removeAllListeners =
Emitter.prototype.removeEventListener = function(event, fn){
Emitter.prototype.removeAllListeners = function(event, fn){
this._callbacks = this._callbacks || {};

// all
if (0 == arguments.length) {
this._callbacks = {};
return this;
}

// specific event
var callbacks = this._callbacks[event];
if (!callbacks) return this;

Expand All @@ -116,14 +106,8 @@ Emitter.prototype.removeEventListener = function(event, fn){
}

// remove specific handler
var cb;
for (var i = 0; i < callbacks.length; i++) {
cb = callbacks[i];
if (cb === fn || cb.fn === fn) {
callbacks.splice(i, 1);
break;
}
}
var i = callbacks.indexOf(fn._off || fn);
if (~i) callbacks.splice(i, 1);
return this;
};

Expand Down Expand Up @@ -689,10 +673,6 @@ Emitter.prototype.hasListeners = function(event){
},
"dragend": function(e) {
return _this.emit("dragend", e);
},
"paste": function(e) {
noPropagation(e);
return _this.paste(e);
}
}
}
Expand Down Expand Up @@ -898,7 +878,6 @@ Emitter.prototype.hasListeners = function(event){

Dropzone.prototype.paste = function(e) {
var items, _ref;
return;
if ((e != null ? (_ref = e.clipboardData) != null ? _ref.items : void 0 : void 0) == null) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion downloads/dropzone-amd-module.min.js

Large diffs are not rendered by default.

31 changes: 5 additions & 26 deletions downloads/dropzone.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,7 @@ function mixin(obj) {
* @api public
*/

Emitter.prototype.on =
Emitter.prototype.addEventListener = function(event, fn){
Emitter.prototype.on = function(event, fn){
this._callbacks = this._callbacks || {};
(this._callbacks[event] = this._callbacks[event] || [])
.push(fn);
Expand All @@ -269,7 +268,7 @@ Emitter.prototype.once = function(event, fn){
fn.apply(this, arguments);
}

on.fn = fn;
fn._off = on;
this.on(event, on);
return this;
};
Expand All @@ -286,17 +285,8 @@ Emitter.prototype.once = function(event, fn){

Emitter.prototype.off =
Emitter.prototype.removeListener =
Emitter.prototype.removeAllListeners =
Emitter.prototype.removeEventListener = function(event, fn){
Emitter.prototype.removeAllListeners = function(event, fn){
this._callbacks = this._callbacks || {};

// all
if (0 == arguments.length) {
this._callbacks = {};
return this;
}

// specific event
var callbacks = this._callbacks[event];
if (!callbacks) return this;

Expand All @@ -307,14 +297,8 @@ Emitter.prototype.removeEventListener = function(event, fn){
}

// remove specific handler
var cb;
for (var i = 0; i < callbacks.length; i++) {
cb = callbacks[i];
if (cb === fn || cb.fn === fn) {
callbacks.splice(i, 1);
break;
}
}
var i = callbacks.indexOf(fn._off || fn);
if (~i) callbacks.splice(i, 1);
return this;
};

Expand Down Expand Up @@ -891,10 +875,6 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
},
"dragend": function(e) {
return _this.emit("dragend", e);
},
"paste": function(e) {
noPropagation(e);
return _this.paste(e);
}
}
}
Expand Down Expand Up @@ -1100,7 +1080,6 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){

Dropzone.prototype.paste = function(e) {
var items, _ref;
return;
if ((e != null ? (_ref = e.clipboardData) != null ? _ref.items : void 0 : void 0) == null) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion downloads/dropzone.min.js

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions lib/dropzone.js
Original file line number Diff line number Diff line change
Expand Up @@ -512,10 +512,6 @@
},
"dragend": function(e) {
return _this.emit("dragend", e);
},
"paste": function(e) {
noPropagation(e);
return _this.paste(e);
}
}
}
Expand Down Expand Up @@ -721,7 +717,6 @@

Dropzone.prototype.paste = function(e) {
var items, _ref;
return;
if ((e != null ? (_ref = e.clipboardData) != null ? _ref.items : void 0 : void 0) == null) {
return;
}
Expand Down
10 changes: 5 additions & 5 deletions src/dropzone.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -560,9 +560,11 @@ class Dropzone extends Em
@drop e
"dragend": (e) =>
@emit "dragend", e
"paste": (e) =>
noPropagation e
@paste e

# This is disabled right now, because the browsers don't implement it properly.
# "paste": (e) =>
# noPropagation e
# @paste e
}
]

Expand Down Expand Up @@ -710,8 +712,6 @@ class Dropzone extends Em
return

paste: (e) ->
return # This is disabled right now, because the browsers don't implement it properly.

return unless e?.clipboardData?.items?

@emit "paste", e
Expand Down

0 comments on commit 6b94cd1

Please sign in to comment.