Browse Source

#930

pull/990/merge
RubaXa 8 years ago
parent
commit
7f1b75d8d0
  1. 14
      Gruntfile.js
  2. 4
      README.md
  3. 26
      Sortable.js
  4. 2
      Sortable.min.js
  5. 6
      package.json

14
Gruntfile.js

@ -39,15 +39,6 @@ module.exports = function (grunt) {
} }
}, },
exec: {
'meteor-test': {
command: 'meteor/runtests.sh'
},
'meteor-publish': {
command: 'meteor/publish.sh'
}
},
jquery: {} jquery: {}
}); });
@ -93,11 +84,6 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-exec'); grunt.loadNpmTasks('grunt-exec');
// Meteor tasks
grunt.registerTask('meteor-test', 'exec:meteor-test');
grunt.registerTask('meteor-publish', 'exec:meteor-publish');
grunt.registerTask('meteor', ['meteor-test', 'meteor-publish']);
grunt.registerTask('tests', ['jshint']); grunt.registerTask('tests', ['jshint']);
grunt.registerTask('default', ['tests', 'version', 'uglify:dist']); grunt.registerTask('default', ['tests', 'version', 'uglify:dist']);
}; };

4
README.md

@ -103,8 +103,8 @@ var sortable = new Sortable(el, {
scrollSensitivity: 30, // px, how near the mouse must be to an edge to start scrolling. scrollSensitivity: 30, // px, how near the mouse must be to an edge to start scrolling.
scrollSpeed: 10, // px scrollSpeed: 10, // px
setData: function (dataTransfer, dragEl) { setData: function (/** DataTransfer */dataTransfer, /** HTMLElement*/dragEl) {
dataTransfer.setData('Text', dragEl.textContent); dataTransfer.setData('Text', dragEl.textContent); // `dataTransfer` object of HTML5 DragEvent
}, },
// Element is chosen // Element is chosen

26
Sortable.js

@ -307,7 +307,7 @@
type = evt.type, type = evt.type,
touch = evt.touches && evt.touches[0], touch = evt.touches && evt.touches[0],
target = (touch || evt).target, target = (touch || evt).target,
originalTarget = target, originalTarget = evt.target.shadowRoot && evt.path[0] || target,
filter = options.filter, filter = options.filter,
startIndex; startIndex;
@ -320,13 +320,13 @@
return; // only left button or enabled return; // only left button or enabled
} }
target = _closest(target, options.draggable, el); if (options.handle && !_closest(originalTarget, options.handle, el)) {
if (!target) {
return; return;
} }
if (options.handle && !_closest(originalTarget, options.handle, el)) { target = _closest(target, options.draggable, el);
if (!target) {
return; return;
} }
@ -641,6 +641,7 @@
var el = this.el, var el = this.el,
target, target,
dragRect, dragRect,
targetRect,
revert, revert,
options = this.options, options = this.options,
group = options.group, group = options.group,
@ -721,9 +722,9 @@
lastParentCSS = _css(target.parentNode); lastParentCSS = _css(target.parentNode);
} }
targetRect = target.getBoundingClientRect();
var targetRect = target.getBoundingClientRect(), var width = targetRect.right - targetRect.left,
width = targetRect.right - targetRect.left,
height = targetRect.bottom - targetRect.top, height = targetRect.bottom - targetRect.top,
floating = /left|right|inline/.test(lastCSS.cssFloat + lastCSS.display) floating = /left|right|inline/.test(lastCSS.cssFloat + lastCSS.display)
|| (lastParentCSS.display == 'flex' && lastParentCSS['flex-direction'].indexOf('row') === 0), || (lastParentCSS.display == 'flex' && lastParentCSS['flex-direction'].indexOf('row') === 0),
@ -1075,14 +1076,21 @@
if ((selector === '>*' && el.parentNode === ctx) || _matches(el, selector)) { if ((selector === '>*' && el.parentNode === ctx) || _matches(el, selector)) {
return el; return el;
} }
} /* jshint boss:true */
while (el !== ctx && (el = el.parentNode)); } while (el = _getParentOrHost(el));
} }
return null; return null;
} }
function _getParentOrHost(el) {
var parent = el.host;
return (parent && parent.nodeType) ? parent : el.parentNode;
}
function _globalDragOver(/**Event*/evt) { function _globalDragOver(/**Event*/evt) {
if (evt.dataTransfer) { if (evt.dataTransfer) {
evt.dataTransfer.dropEffect = 'move'; evt.dataTransfer.dropEffect = 'move';

2
Sortable.min.js vendored

File diff suppressed because one or more lines are too long

6
package.json

@ -5,10 +5,8 @@
"devDependencies": { "devDependencies": {
"grunt": "*", "grunt": "*",
"grunt-version": "*", "grunt-version": "*",
"grunt-exec": "*", "grunt-contrib-jshint": "*",
"grunt-contrib-jshint": "0.9.2", "grunt-contrib-uglify": "*"
"grunt-contrib-uglify": "*",
"spacejam": "*"
}, },
"description": "Minimalist JavaScript library for reorderable drag-and-drop lists on modern browsers and touch devices. No jQuery. Supports AngularJS and any CSS library, e.g. Bootstrap.", "description": "Minimalist JavaScript library for reorderable drag-and-drop lists on modern browsers and touch devices. No jQuery. Supports AngularJS and any CSS library, e.g. Bootstrap.",
"main": "Sortable.js", "main": "Sortable.js",

Loading…
Cancel
Save