fix editor, update libs shaka-player
This commit is contained in:
parent
926a465040
commit
c321f6321e
@ -434,6 +434,9 @@ const editorHandler = (() => {
|
||||
forceFallback: true,
|
||||
ghostClass: 'sortable-ghost',
|
||||
fallbackClass: 'sortable-fallback',
|
||||
scroll: true,
|
||||
scrollSensitivity: 100,
|
||||
scrollSpeed: 15,
|
||||
onStart: () => {
|
||||
document.body.classList.add('editor-is-dragging');
|
||||
},
|
||||
@ -446,22 +449,31 @@ const editorHandler = (() => {
|
||||
if (item.classList.contains('group-header-row')) {
|
||||
const [movedGroup] = groupOrder.splice(oldIndex, 1);
|
||||
groupOrder.splice(newIndex, 0, movedGroup);
|
||||
renderTable(); // Re-render for group order changes
|
||||
}
|
||||
else if (item.classList.contains('channel-row') && currentGroupFilter !== '') {
|
||||
const movedItemId = item.dataset.editorId;
|
||||
const fromIndex = editorChannels.findIndex(ch => ch.editorId === movedItemId);
|
||||
const [movedItem] = editorChannels.splice(fromIndex, 1);
|
||||
|
||||
const allVisibleIdsInOrder = Array.from(dom.tableBody.querySelectorAll('.channel-row')).map(row => row.dataset.editorId);
|
||||
const toVisibleIndex = allVisibleIdsInOrder.indexOf(movedItemId);
|
||||
|
||||
const channelsInCurrentGroup = editorChannels.filter(ch => (ch['group-title'] || '') === currentGroupFilter);
|
||||
const channelsInOtherGroups = editorChannels.filter(ch => (ch['group-title'] || '') !== currentGroupFilter);
|
||||
let targetIndexInFullArray = -1;
|
||||
if (toVisibleIndex === 0) {
|
||||
const firstVisibleChannelId = allVisibleIdsInOrder[1];
|
||||
targetIndexInFullArray = editorChannels.findIndex(ch => ch.editorId === firstVisibleChannelId);
|
||||
} else {
|
||||
const previousVisibleChannelId = allVisibleIdsInOrder[toVisibleIndex -1];
|
||||
targetIndexInFullArray = editorChannels.findIndex(ch => ch.editorId === previousVisibleChannelId) + 1;
|
||||
}
|
||||
|
||||
const channelMap = new Map(channelsInCurrentGroup.map(ch => [ch.editorId, ch]));
|
||||
editorChannels.splice(targetIndexInFullArray, 0, movedItem);
|
||||
|
||||
const reorderedGroup = allVisibleIdsInOrder.map(id => channelMap.get(id));
|
||||
|
||||
editorChannels = [...channelsInOtherGroups, ...reorderedGroup];
|
||||
// No re-render, just move the element in DOM which Sortable does automatically
|
||||
}
|
||||
|
||||
currentSort.column = null;
|
||||
renderTable();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user