Skip to content

Commit

Permalink
pat sortable - fixup lazy loading
Browse files Browse the repository at this point in the history
  • Loading branch information
thet committed Feb 10, 2021
1 parent a37a86b commit 6d1ff88
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/pat/sortable/sortable.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import "regenerator-runtime/runtime"; // needed for ``await`` support
import $ from "jquery";
import Base from "patternslib/src/core/base";
import Sortable from "sortablejs";

export default Base.extend({
name: "sortable",
Expand All @@ -12,8 +12,10 @@ export default Base.extend({
cloneClass: "dragging",
drop: undefined, // callback function or name of global function
},
init: function () {
var sortable = new Sortable(this.$el[0], {
init: async function () {
let Sortable = await import("sortablejs");
Sortable = Sortable.default;
new Sortable(this.$el[0], {
draggable: this.options.selector,
chosenClass: this.options.dragClass,
dragClass: this.options.cloneClass,
Expand Down

0 comments on commit 6d1ff88

Please sign in to comment.