Skip to content

Commit 7fd5baf

Browse files
committed
#1897: Prevent multi-select of non-draggable and filtered items
1 parent afb71dc commit 7fd5baf

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

plugins/MultiDrag/MultiDrag.js

+11
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,19 @@ function MultiDragPlugin() {
342342
n = lastIndex + 1;
343343
}
344344

345+
const filter = options.filter;
346+
345347
for (; i < n; i++) {
346348
if (~multiDragElements.indexOf(children[i])) continue;
349+
// Check if element is draggable
350+
if (!closest(children[i], options.draggable, parentEl, false)) continue;
351+
// Check if element is filtered
352+
const filtered = filter && (typeof filter === 'function' ?
353+
filter.call(sortable, evt, children[i], sortable) :
354+
filter.split(',').some((criteria) => {
355+
return closest(children[i], criteria.trim(), parentEl, false);
356+
}));
357+
if (filtered) continue;
347358
toggleClass(children[i], options.selectedClass, true);
348359
multiDragElements.push(children[i]);
349360

0 commit comments

Comments
 (0)