From 6d1ff881177a1a425d7cf1898fc33c4c46bc3f73 Mon Sep 17 00:00:00 2001 From: Johannes Raggam Date: Wed, 10 Feb 2021 14:33:57 +0100 Subject: [PATCH] pat sortable - fixup lazy loading --- src/pat/sortable/sortable.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/pat/sortable/sortable.js b/src/pat/sortable/sortable.js index e74e1a17c..b0579812f 100644 --- a/src/pat/sortable/sortable.js +++ b/src/pat/sortable/sortable.js @@ -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", @@ -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,