diff --git a/paste.coffee b/paste.coffee index 7cf1921..78fc758 100644 --- a/paste.coffee +++ b/paste.coffee @@ -114,7 +114,7 @@ class Paste @mountTextarea: (textarea)-> # Firefox & IE - return @mountContenteditable textarea if DataTransfer?.prototype.__lookupGetter__('items') + return @mountContenteditable textarea if DataTransfer?.prototype && Object.getOwnPropertyDescriptor?.call(Object, DataTransfer.prototype, 'items')?.get paste = new Paste createHiddenEditable().insertBefore(textarea), textarea ctlDown = false $(textarea).on 'keyup', (ev)-> diff --git a/paste.js b/paste.js index cae9489..d133293 100644 --- a/paste.js +++ b/paste.js @@ -160,22 +160,22 @@ https://github.com/layerssss/paste.js }; Paste.mountTextarea = function(textarea) { - var ctlDown, paste; - if (typeof DataTransfer !== "undefined" && DataTransfer !== null ? DataTransfer.prototype.__lookupGetter__('items') : void 0) { + var ctlDown, paste, ref, ref1; + if ((typeof DataTransfer !== "undefined" && DataTransfer !== null ? DataTransfer.prototype : void 0) && ((ref = Object.getOwnPropertyDescriptor) != null ? (ref1 = ref.call(Object, DataTransfer.prototype, 'items')) != null ? ref1.get : void 0 : void 0)) { return this.mountContenteditable(textarea); } paste = new Paste(createHiddenEditable().insertBefore(textarea), textarea); ctlDown = false; $(textarea).on('keyup', function(ev) { - var ref; - if ((ref = ev.keyCode) === 17 || ref === 224) { + var ref2; + if ((ref2 = ev.keyCode) === 17 || ref2 === 224) { ctlDown = false; } return null; }); $(textarea).on('keydown', function(ev) { - var ref; - if ((ref = ev.keyCode) === 17 || ref === 224) { + var ref2; + if ((ref2 = ev.keyCode) === 17 || ref2 === 224) { ctlDown = true; } if ((ev.ctrlKey != null) && (ev.metaKey != null)) {