Move from dragula to sortablejs
This commit is contained in:
parent
a34efab009
commit
c6e5b4a385
8 changed files with 2552 additions and 913 deletions
20
src/index.js
20
src/index.js
|
@ -60,19 +60,19 @@ class TabGroup extends HTMLElement {
|
|||
|
||||
// Init draggable tabs
|
||||
if (this.options.draggable) {
|
||||
const initDragula = () => {
|
||||
// FIXME: dragula doesnt support shadow dom :-(
|
||||
console.log(this.tabContainer);
|
||||
const d =window.dragula([this.tabContainer], {
|
||||
direction: "horizontal"
|
||||
});
|
||||
console.log(d);
|
||||
const initSortable = () => {
|
||||
const options = Object.assign({
|
||||
direction: "horizontal",
|
||||
animation: 150,
|
||||
swapThreshold: 0.20
|
||||
}, this.options.draggableOptions);
|
||||
new window.Sortable(this.tabContainer, options);
|
||||
};
|
||||
|
||||
if (window.dragula) {
|
||||
initDragula();
|
||||
if (window.Sortable) {
|
||||
initSortable();
|
||||
} else {
|
||||
document.addEventListener("DOMContentLoaded", initDragula);
|
||||
document.addEventListener("DOMContentLoaded", initSortable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue