Skip to content

Commit

Permalink
#1897: Prevent multi-select of non-draggable and filtered items
Browse files Browse the repository at this point in the history
  • Loading branch information
owen-m1 committed Nov 23, 2024
1 parent afb71dc commit 7fd5baf
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions plugins/MultiDrag/MultiDrag.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,19 @@ function MultiDragPlugin() {
n = lastIndex + 1;
}

const filter = options.filter;

for (; i < n; i++) {
if (~multiDragElements.indexOf(children[i])) continue;
// Check if element is draggable
if (!closest(children[i], options.draggable, parentEl, false)) continue;
// Check if element is filtered
const filtered = filter && (typeof filter === 'function' ?
filter.call(sortable, evt, children[i], sortable) :
filter.split(',').some((criteria) => {
return closest(children[i], criteria.trim(), parentEl, false);
}));
if (filtered) continue;
toggleClass(children[i], options.selectedClass, true);
multiDragElements.push(children[i]);

Expand Down

0 comments on commit 7fd5baf

Please sign in to comment.