]> BookStack Code Mirror - bookstack/blobdiff - resources/js/components/shelf-sort.js
Merge pull request #4002 from BookStackApp/color_upgrades
[bookstack] / resources / js / components / shelf-sort.js
index 07526716a932da86ca34bbec46f8e8cbfa4bf7b3..d10470bd79a4ea7e19774bcb5eedc3c6e533ffad 100644 (file)
@@ -1,6 +1,7 @@
 import Sortable from "sortablejs";
+import {Component} from "./component";
 
-class ShelfSort {
+export class ShelfSort extends Component {
 
     setup() {
         this.elem = this.$el;
@@ -15,10 +16,11 @@ class ShelfSort {
 
     initSortable() {
         const scrollBoxes = this.elem.querySelectorAll('.scroll-box');
-        for (let scrollBox of scrollBoxes) {
+        for (const scrollBox of scrollBoxes) {
             new Sortable(scrollBox, {
                 group: 'shelf-books',
                 ghostClass: 'primary-background-light',
+                handle: '.handle',
                 animation: 150,
                 onSort: this.onChange.bind(this),
             });
@@ -77,6 +79,4 @@ class ShelfSort {
         this.input.value = shelfBookElems.map(elem => elem.getAttribute('data-id')).join(',');
     }
 
-}
-
-export default ShelfSort;
\ No newline at end of file
+}
\ No newline at end of file