From e5d428aa8d8de821f0d8001eeade849851fb5a2d Mon Sep 17 00:00:00 2001 From: Agnaev Date: Mon, 27 Sep 2021 17:08:04 +0300 Subject: [PATCH 1/2] avoid implicit deselect on outside click --- plugins/MultiDrag/MultiDrag.js | 13 ++++++++----- plugins/MultiDrag/README.md | 3 ++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/plugins/MultiDrag/MultiDrag.js b/plugins/MultiDrag/MultiDrag.js index 03f0077c5..db9b7bc09 100644 --- a/plugins/MultiDrag/MultiDrag.js +++ b/plugins/MultiDrag/MultiDrag.js @@ -35,11 +35,13 @@ function MultiDragPlugin() { } } - if (sortable.options.supportPointer) { - on(document, 'pointerup', this._deselectMultiDrag); - } else { - on(document, 'mouseup', this._deselectMultiDrag); - on(document, 'touchend', this._deselectMultiDrag); + if (!sortable.options.avoidImplicitDeselect) { + if (sortable.options.supportPointer) { + on(document, 'pointerup', this._deselectMultiDrag); + } else { + on(document, 'mouseup', this._deselectMultiDrag); + on(document, 'touchend', this._deselectMultiDrag); + } } on(document, 'keydown', this._checkKeyDown); @@ -48,6 +50,7 @@ function MultiDragPlugin() { this.defaults = { selectedClass: 'sortable-selected', multiDragKey: null, + avoidImplicitDeselect: false, setData(dataTransfer, dragEl) { let data = ''; if (multiDragElements.length && multiDragSortable === sortable) { diff --git a/plugins/MultiDrag/README.md b/plugins/MultiDrag/README.md index a7cb4d596..1056b8aaf 100644 --- a/plugins/MultiDrag/README.md +++ b/plugins/MultiDrag/README.md @@ -27,7 +27,8 @@ new Sortable(el, { multiDrag: true, // Enable the plugin selectedClass: "sortable-selected", // Class name for selected item multiDragKey: null, // Key that must be down for items to be selected - + avoidImplicitDeselect: true, // true - if you don't want to deselect items on outside click + // Called when an item is selected onSelect: function(/**Event*/evt) { evt.item // The selected item From 796bb3f7f2a59da8de2244c26ce787d3b9be7374 Mon Sep 17 00:00:00 2001 From: Owen Mills Date: Sun, 3 Oct 2021 15:29:35 -0400 Subject: [PATCH 2/2] Update README.md --- plugins/MultiDrag/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/MultiDrag/README.md b/plugins/MultiDrag/README.md index 1056b8aaf..0eab03e73 100644 --- a/plugins/MultiDrag/README.md +++ b/plugins/MultiDrag/README.md @@ -27,7 +27,7 @@ new Sortable(el, { multiDrag: true, // Enable the plugin selectedClass: "sortable-selected", // Class name for selected item multiDragKey: null, // Key that must be down for items to be selected - avoidImplicitDeselect: true, // true - if you don't want to deselect items on outside click + avoidImplicitDeselect: false, // true - if you don't want to deselect items on outside click // Called when an item is selected onSelect: function(/**Event*/evt) {