X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/ee24635e06a8c01d751f80caba47c57f76e8989d..8367a94e90e5e1bf7d06defe30d570ade2f00599:/resources/js/components/shelf-sort.js diff --git a/resources/js/components/shelf-sort.js b/resources/js/components/shelf-sort.js index 07526716a..d10470bd7 100644 --- a/resources/js/components/shelf-sort.js +++ b/resources/js/components/shelf-sort.js @@ -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