Skip to content

Commit b8940a9

Browse files
authored
Merge pull request #2084 from Agnaev/master
avoid implicit deselect on outside click
2 parents 21f7ede + 796bb3f commit b8940a9

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

plugins/MultiDrag/MultiDrag.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,13 @@ function MultiDragPlugin() {
3535
}
3636
}
3737

38-
if (sortable.options.supportPointer) {
39-
on(document, 'pointerup', this._deselectMultiDrag);
40-
} else {
41-
on(document, 'mouseup', this._deselectMultiDrag);
42-
on(document, 'touchend', this._deselectMultiDrag);
38+
if (!sortable.options.avoidImplicitDeselect) {
39+
if (sortable.options.supportPointer) {
40+
on(document, 'pointerup', this._deselectMultiDrag);
41+
} else {
42+
on(document, 'mouseup', this._deselectMultiDrag);
43+
on(document, 'touchend', this._deselectMultiDrag);
44+
}
4345
}
4446

4547
on(document, 'keydown', this._checkKeyDown);
@@ -48,6 +50,7 @@ function MultiDragPlugin() {
4850
this.defaults = {
4951
selectedClass: 'sortable-selected',
5052
multiDragKey: null,
53+
avoidImplicitDeselect: false,
5154
setData(dataTransfer, dragEl) {
5255
let data = '';
5356
if (multiDragElements.length && multiDragSortable === sortable) {

plugins/MultiDrag/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ new Sortable(el, {
2727
multiDrag: true, // Enable the plugin
2828
selectedClass: "sortable-selected", // Class name for selected item
2929
multiDragKey: null, // Key that must be down for items to be selected
30-
30+
avoidImplicitDeselect: false, // true - if you don't want to deselect items on outside click
31+
3132
// Called when an item is selected
3233
onSelect: function(/**Event*/evt) {
3334
evt.item // The selected item

0 commit comments

Comments
 (0)