Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jquery 3.0 compatible #242

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.DS_Store
node_modules
bower_components
yarn.lock
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably use unix line ending (add a newline)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much Mlunoe: now cropit works with jquery 3

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@klucznik did all the hard work though

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
yarn.lock
yarn.lock

8 changes: 2 additions & 6 deletions dist/jquery.cropit.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,10 +270,6 @@ return /******/ (function(modules) { // webpackBootstrap

this.zoomer = new _Zoomer2['default']();

if (this.options.allowDragNDrop) {
_jquery2['default'].event.props.push('dataTransfer');
}

this.bindListeners();

if (this.options.imageState && this.options.imageState.src) {
Expand Down Expand Up @@ -335,7 +331,7 @@ return /******/ (function(modules) { // webpackBootstrap
key: 'onDragOver',
value: function onDragOver(e) {
e.preventDefault();
e.dataTransfer.dropEffect = 'copy';
e.originalEvent.dataTransfer.dropEffect = 'copy';
this.$preview.toggleClass(_constants.CLASS_NAMES.DRAG_HOVERED, e.type === 'dragover');
}
}, {
Expand All @@ -346,7 +342,7 @@ return /******/ (function(modules) { // webpackBootstrap
e.preventDefault();
e.stopPropagation();

var files = Array.prototype.slice.call(e.dataTransfer.files, 0);
var files = Array.prototype.slice.call(e.originalEvent.dataTransfer.files, 0);
files.some(function (file) {
if (!file.type.match('image')) {
return false;
Expand Down
8 changes: 2 additions & 6 deletions src/cropit.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,6 @@ class Cropit {

this.zoomer = new Zoomer();

if (this.options.allowDragNDrop) {
$.event.props.push('dataTransfer');
}

this.bindListeners();

if (this.options.imageState && this.options.imageState.src) {
Expand Down Expand Up @@ -157,15 +153,15 @@ class Cropit {

onDragOver(e) {
e.preventDefault();
e.dataTransfer.dropEffect = 'copy';
e.originalEvent.dataTransfer.dropEffect = 'copy';
this.$preview.toggleClass(CLASS_NAMES.DRAG_HOVERED, e.type === 'dragover');
}

onDrop(e) {
e.preventDefault();
e.stopPropagation();

const files = Array.prototype.slice.call(e.dataTransfer.files, 0);
const files = Array.prototype.slice.call(e.originalEvent.dataTransfer.files, 0);
files.some((file) => {
if (!file.type.match('image')) { return false; }

Expand Down