]> BookStack Code Mirror - bookstack/blob - resources/js/components/sortable-list.js
Started migration of attachment manager from vue
[bookstack] / resources / js / components / sortable-list.js
1 import Sortable from "sortablejs";
2
3 /**
4  * SortableList
5  * @extends {Component}
6  */
7 class SortableList {
8     setup() {
9         this.container = this.$el;
10         this.handleSelector = this.$opts.handleSelector;
11
12         const sortable = new Sortable(this.container, {
13             handle: this.handleSelector,
14             animation: 150,
15             onSort: () => {
16                 this.$emit('sort', {ids: sortable.toArray()});
17             }
18         });
19     }
20 }
21
22 export default SortableList;