File tree 3 files changed +10
-7
lines changed
3 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -2,9 +2,9 @@ import $ from 'jquery';
2
2
import { updateIssuesMeta } from './repo-issue.js' ;
3
3
import { toggleElem } from '../utils/dom.js' ;
4
4
import { htmlEscape } from 'escape-goat' ;
5
- import { Sortable } from 'sortablejs' ;
6
5
import { confirmModal } from './comp/ConfirmModal.js' ;
7
6
import { showErrorToast } from '../modules/toast.js' ;
7
+ import { createSortable } from '../modules/sortable.js' ;
8
8
9
9
function initRepoIssueListCheckboxes ( ) {
10
10
const $issueSelectAll = $ ( '.issue-checkbox-all' ) ;
@@ -176,7 +176,7 @@ async function pinMoveEnd(e) {
176
176
} ) ;
177
177
}
178
178
179
- function initIssuePinSort ( ) {
179
+ async function initIssuePinSort ( ) {
180
180
const pinDiv = document . getElementById ( 'issue-pins' ) ;
181
181
182
182
if ( pinDiv === null ) return ;
@@ -189,7 +189,7 @@ function initIssuePinSort() {
189
189
// If only one issue pinned, we don't need to make this Sortable
190
190
if ( pinDiv . children . length < 2 ) return ;
191
191
192
- new Sortable ( pinDiv , {
192
+ createSortable ( pinDiv , {
193
193
group : 'shared' ,
194
194
animation : 150 ,
195
195
ghostClass : 'card-ghost' ,
Original file line number Diff line number Diff line change 1
1
import $ from 'jquery' ;
2
2
import { useLightTextOnBackground } from '../utils/color.js' ;
3
3
import tinycolor from 'tinycolor2' ;
4
+ import { createSortable } from '../modules/sortable.js' ;
4
5
5
6
const { csrfToken} = window . config ;
6
7
@@ -55,12 +56,10 @@ async function initRepoProjectSortable() {
55
56
const els = document . querySelectorAll ( '#project-board > .board.sortable' ) ;
56
57
if ( ! els . length ) return ;
57
58
58
- const { Sortable} = await import ( /* webpackChunkName: "sortable" */ 'sortablejs' ) ;
59
-
60
59
// the HTML layout is: #project-board > .board > .board-column .board.cards > .board-card.card .content
61
60
const mainBoard = els [ 0 ] ;
62
61
let boardColumns = mainBoard . getElementsByClassName ( 'board-column' ) ;
63
- new Sortable ( mainBoard , {
62
+ createSortable ( mainBoard , {
64
63
group : 'board-column' ,
65
64
draggable : '.board-column' ,
66
65
filter : '[data-id="0"]' ,
@@ -89,7 +88,7 @@ async function initRepoProjectSortable() {
89
88
90
89
for ( const boardColumn of boardColumns ) {
91
90
const boardCardList = boardColumn . getElementsByClassName ( 'board' ) [ 0 ] ;
92
- new Sortable ( boardCardList , {
91
+ createSortable ( boardCardList , {
93
92
group : 'shared' ,
94
93
animation : 150 ,
95
94
ghostClass : 'card-ghost' ,
Original file line number Diff line number Diff line change
1
+ export async function createSortable ( ...args ) {
2
+ const { Sortable} = await import ( /* webpackChunkName: "sortablejs" */ 'sortablejs' ) ;
3
+ return new Sortable ( ...args ) ;
4
+ }
You can’t perform that action at this time.
0 commit comments