1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-28 17:02:04 +03:00

Improves sortable ux

- Fixes multi-select functionality.
- Updated other books to be sticky.
- Added some general intro/desc text.
- Updated sort boxes to be collapsible.
- Cleaned up other books styling.
This commit is contained in:
Dan Brown
2023-01-27 11:16:17 +00:00
parent 03ad288aaa
commit a3e7e754b9
7 changed files with 51 additions and 15 deletions

View File

@ -1,4 +1,4 @@
import Sortable from "sortablejs";
import Sortable, {MultiDrag} from "sortablejs";
import {Component} from "./component";
import {htmlToDom} from "../services/dom";
@ -44,6 +44,8 @@ export class BookSort extends Component {
this.sortContainer = this.$refs.sortContainer;
this.input = this.$refs.input;
Sortable.mount(new MultiDrag());
const initialSortBox = this.container.querySelector('.sort-box');
this.setupBookSortable(initialSortBox);
this.setupSortPresets();
@ -104,7 +106,7 @@ export class BookSort extends Component {
}
/**
* Setup the given book container element to have sortable items.
* Set up the given book container element to have sortable items.
* @param {Element} bookContainer
*/
setupBookSortable(bookContainer) {
@ -125,8 +127,8 @@ export class BookSort extends Component {
}
};
for (let sortElem of sortElems) {
new Sortable(sortElem, {
for (const sortElem of sortElems) {
Sortable.create(sortElem, {
group: sortElem.classList.contains('sort-list') ? bookGroupConfig : chapterGroupConfig,
animation: 150,
fallbackOnBody: true,
@ -135,7 +137,7 @@ export class BookSort extends Component {
dragClass: 'bg-white',
ghostClass: 'primary-background-light',
multiDrag: true,
multiDragKey: 'CTRL',
multiDragKey: 'Control',
selectedClass: 'sortable-selected',
});
}