Created
October 15, 2021 07:31
-
-
Save ducho/cadc78c9f0915466c016c8371cd58122 to your computer and use it in GitHub Desktop.
Sortable Stimulus Controller for nested sortable component
This file contains hidden or 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
import Sortable from "stimulus-sortable" | |
export default class extends Sortable { | |
connect() { | |
super.connect() | |
this.defaultOptions | |
} | |
async end({ item, newIndex }) { | |
super.end({ item, newIndex }); | |
} | |
get defaultOptions() { | |
return { | |
group: 'nested', | |
animation: 150, | |
fallbackOnBody: true, | |
swapThreshold: 0.65 | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment