Sha256: 3e092c62b34aa55ef679183ed1af3f5130179c5b09dd01014abce2c8ab41b4c9
Contents?: true
Size: 832 Bytes
Versions: 20
Compression:
Stored size: 832 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, connectWith: ".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
20 entries across 20 versions & 1 rubygems