mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-21 15:09:10 +00:00
handle rearange in block (#1682)
This commit is contained in:
committed by
GitHub
parent
f2913971db
commit
ab8bfbcd59
@@ -318,13 +318,24 @@ export default function Rundown({ data }: RundownProps) {
|
|||||||
* We need to specially handle the end blocks
|
* We need to specially handle the end blocks
|
||||||
* Dragging before and end block will add the entry to the end of the block
|
* Dragging before and end block will add the entry to the end of the block
|
||||||
* Dragging after an end block will add the event after the block itself
|
* Dragging after an end block will add the event after the block itself
|
||||||
|
* Dragging to the top of a block either place before first entry or if no entries do insert
|
||||||
*/
|
*/
|
||||||
if (destinationId.startsWith('end-')) {
|
if (destinationId.startsWith('end-')) {
|
||||||
destinationId = destinationId.replace('end-', '');
|
destinationId = destinationId.replace('end-', '');
|
||||||
// if we are moving before the end, we use the insert operation
|
// if we are moving before the end, we use the insert operation
|
||||||
order = 'insert';
|
if (order === 'before') {
|
||||||
|
order = 'insert';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const block = data.entries[destinationId];
|
||||||
|
if (isOntimeBlock(block) && order === 'after') {
|
||||||
|
if (block.entries.length === 0) order = 'insert';
|
||||||
|
else {
|
||||||
|
destinationId = block.entries[0];
|
||||||
|
order = 'before';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
reorderEntry(active.id as EntryId, destinationId, order);
|
reorderEntry(active.id as EntryId, destinationId, order);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user