2016-12-14 03:01:05 +00:00
|
|
|
/* global DocumentTouch */
|
|
|
|
|
2019-06-26 10:05:37 +00:00
|
|
|
import sortableConfig from 'ee_else_ce/sortable/sortable_config';
|
2018-02-19 19:06:16 +00:00
|
|
|
|
2018-10-10 17:08:43 +00:00
|
|
|
export function sortableStart() {
|
2017-04-10 23:52:46 +00:00
|
|
|
document.body.classList.add('is-dragging');
|
2018-10-10 17:08:43 +00:00
|
|
|
}
|
2016-08-19 09:09:22 +00:00
|
|
|
|
2018-10-10 17:08:43 +00:00
|
|
|
export function sortableEnd() {
|
2017-04-10 23:52:46 +00:00
|
|
|
document.body.classList.remove('is-dragging');
|
2018-10-10 17:08:43 +00:00
|
|
|
}
|
2016-08-19 13:16:07 +00:00
|
|
|
|
2018-10-10 17:08:43 +00:00
|
|
|
export function getBoardSortableDefaultOptions(obj) {
|
2018-10-30 20:28:31 +00:00
|
|
|
const touchEnabled =
|
|
|
|
'ontouchstart' in window || (window.DocumentTouch && document instanceof DocumentTouch);
|
2016-08-11 08:51:52 +00:00
|
|
|
|
2020-05-07 21:09:26 +00:00
|
|
|
const defaultSortOptions = {
|
|
|
|
...sortableConfig,
|
2019-06-28 21:20:05 +00:00
|
|
|
filter: '.no-drag',
|
2018-10-10 17:08:43 +00:00
|
|
|
delay: touchEnabled ? 100 : 0,
|
|
|
|
scrollSensitivity: touchEnabled ? 60 : 100,
|
2017-04-10 23:52:46 +00:00
|
|
|
scrollSpeed: 20,
|
2018-10-10 17:08:43 +00:00
|
|
|
onStart: sortableStart,
|
|
|
|
onEnd: sortableEnd,
|
2020-05-07 21:09:26 +00:00
|
|
|
};
|
2017-04-10 23:52:46 +00:00
|
|
|
|
2020-12-23 21:10:24 +00:00
|
|
|
Object.keys(obj).forEach((key) => {
|
2018-10-30 20:28:31 +00:00
|
|
|
defaultSortOptions[key] = obj[key];
|
|
|
|
});
|
2017-04-10 23:52:46 +00:00
|
|
|
return defaultSortOptions;
|
2018-10-10 17:08:43 +00:00
|
|
|
}
|