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: {}
});
@ -93,11 +84,6 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-contrib-uglify');
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('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.
scrollSpeed: 10, // px
setData: function (dataTransfer, dragEl) {
dataTransfer.setData('Text', dragEl.textContent);
setData: function (/** DataTransfer */dataTransfer, /** HTMLElement*/dragEl) {
dataTransfer.setData('Text', dragEl.textContent); // `dataTransfer` object of HTML5 DragEvent
},
// Element is chosen

26
Sortable.js

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

Loading…
Cancel
Save