Sha256: 277d0551643b6a0ac765886d808cc3704bbd71d0a093fe1c7e8b1ff033887a4d
Contents?: true
Size: 831 Bytes
Versions: 24
Compression:
Stored size: 831 Bytes
Contents
/* eslint-disable require-jsdoc */ import createSortList from "src/decidim/admin/sort_list.component" export default function createSortableList(lists) { createSortList(lists, { handle: "li", forcePlaceholderSize: true, acceptFrom: ".js-connect" }) } // Once in DOM $(() => { const $draggables = $(".draggable-list") let draggablesClassNames = [] $draggables.each((index, elem) => { draggablesClassNames = [...draggablesClassNames, `.${elem.className.split(" ").filter((name) => (/js-list.*/).test(name))[0]}`] }) document.addEventListener("drag", function (event) { $draggables.not(event.target.parentElement).addClass("dragging") }) document.addEventListener("dragend", function() { $draggables.removeClass("dragging") }) createSortableList(draggablesClassNames.join(", ")) })
Version data entries
24 entries across 24 versions & 1 rubygems