Skip to content

Commit 5f3076c

Browse files
committed
feat(pat-sortable): Support dynamic sortable lists.
When new items were added to a sortable list e.g. via pat-clone or pat-inject, those items could not be sorted. We are now re-initializing the sortable pattern after a `pat-update` event and make new elements sortable.
1 parent 0513102 commit 5f3076c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/pat/sortable/sortable.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default Base.extend({
2020
}
2121
this.$form = this.$el.closest("form");
2222
this.options = parser.parse(this.$el, false);
23-
this.recordPositions().addHandles().initScrolling();
23+
this.recordPositions().initScrolling();
2424
this.$el.on("pat-update", this.onPatternUpdate.bind(this));
2525
},
2626

@@ -44,6 +44,7 @@ export default Base.extend({
4444
// Add `.sortable-item` class to each sortable.
4545
this.classList.add("sortable-item");
4646
});
47+
this.addHandles();
4748
return this;
4849
},
4950

0 commit comments

Comments
 (0)