-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[JENKINS-64291] Fix drag & drop issues replacing the drag & drop libr…
…ary (#5177) Co-authored-by: Gavin Mogan <[email protected]>
- Loading branch information
Showing
12 changed files
with
77 additions
and
170 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* This module provides drag & drop functionality used by certain components, | ||
* such as f:repeatable or f:hetero-list. | ||
* | ||
* It does so using the SortableJS library. | ||
* | ||
* NOTE: there is another Sortable class exposed to the window namespace, this | ||
* corresponds to the sortable.js file that deals with table sorting. | ||
*/ | ||
|
||
import Sortable, { AutoScroll } from 'sortablejs/modular/sortable.core.esm.js'; | ||
|
||
Sortable.mount(new AutoScroll()); | ||
|
||
function registerSortableDragDrop(e) { | ||
if (!e || !e.classList.contains('with-drag-drop')) return false; | ||
|
||
const sortableElement = new Sortable(e, { | ||
draggable: '.repeated-chunk', | ||
handle: '.dd-handle', | ||
ghostClass: 'repeated-chunk--sortable-ghost', | ||
chosenClass: 'repeated-chunk--sortable-chosen', | ||
forceFallback: true, // Do not use html5 drag & drop behaviour because it does not work with autoscroll | ||
scroll: true, | ||
bubbleScroll: true, | ||
}); | ||
} | ||
|
||
/* | ||
* Expose the function to register drag & drop components to the window objects | ||
* so that other widgets can use it (repeatable, hetero-list) | ||
*/ | ||
window.registerSortableDragDrop = registerSortableDragDrop; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.