/** * Перетаскивание на экране роликов. В сборку блока едут только ролики, в группу — и ролики, * и готовые блоки, поэтому в переносимых данных лежит вид элемента, а не только идентификатор. */ export type ClipDragItem = { kind: 'clip' | 'block' id: string name: string seconds: number } const MIME = 'application/x-telewave-clip' export function setDragItem(event: React.DragEvent, item: ClipDragItem) { event.dataTransfer.setData(MIME, JSON.stringify(item)) event.dataTransfer.effectAllowed = 'copy' } export function readDragItem(event: React.DragEvent): ClipDragItem | null { const raw = event.dataTransfer.getData(MIME) if (!raw) return null try { return JSON.parse(raw) as ClipDragItem } catch { return null } }