feat(rundown): add shortcut to jump to current element

This commit is contained in:
Carlos Valente
2026-07-18 16:50:43 +02:00
committed by Carlos Valente
parent f234a1f892
commit 347c748dd9
3 changed files with 24 additions and 0 deletions
@@ -105,12 +105,29 @@ export default function Rundown({ order, flatOrder, entries, id, rundownMetadata
handleCollapseGroup, handleCollapseGroup,
}); });
// Jump to the current element on demand: the running event in Run mode, the edit cursor otherwise.
// Scrolls only (no selection change) so jumping to the running event does not hijack the edit cursor.
const jumpToCurrent = useCallback(() => {
const targetId = editorMode === AppMode.Run ? featureData?.selectedEventId : cursor;
if (!targetId) {
return;
}
// Open parent group if the target is inside a collapsed group
const entry = entries[targetId];
if (entry && 'parent' in entry) {
expandGroup(entry.parent);
}
scrollToEntry(targetId);
}, [editorMode, featureData?.selectedEventId, cursor, entries, expandGroup, scrollToEntry]);
// Keyboard shortcuts // Keyboard shortcuts
useRundownKeyboard({ useRundownKeyboard({
cursor, cursor,
commands, commands,
clearSelectedEvents, clearSelectedEvents,
setEntryCopyId, setEntryCopyId,
jumpToCurrent,
}); });
// DND handlers // DND handlers
@@ -44,6 +44,9 @@ function EventEditorEmpty() {
<Separator /> <Separator />
<Combo keys={['PgDn']} /> <Combo keys={['PgDn']} />
</Shortcut> </Shortcut>
<Shortcut label='Jump to current entry'>
<Combo keys={[deviceAlt, 'L']} />
</Shortcut>
<Shortcut label='Deselect entry'> <Shortcut label='Deselect entry'>
<Combo keys={['Esc']} /> <Combo keys={['Esc']} />
</Shortcut> </Shortcut>
@@ -19,6 +19,7 @@ interface UseRundownKeyboardOptions {
}; };
clearSelectedEvents: () => void; clearSelectedEvents: () => void;
setEntryCopyId: (id: EntryId | null, mode?: 'copy' | 'cut') => void; setEntryCopyId: (id: EntryId | null, mode?: 'copy' | 'cut') => void;
jumpToCurrent: () => void;
} }
/** /**
@@ -40,6 +41,7 @@ export function useRundownKeyboard({
commands, commands,
clearSelectedEvents, clearSelectedEvents,
setEntryCopyId, setEntryCopyId,
jumpToCurrent,
}: UseRundownKeyboardOptions) { }: UseRundownKeyboardOptions) {
const scrollToEntry = useEventSelection((state) => state.scrollToEntry); const scrollToEntry = useEventSelection((state) => state.scrollToEntry);
@@ -127,6 +129,8 @@ export function useRundownKeyboard({
{ preventDefault: true, usePhysicalKeys: true }, { preventDefault: true, usePhysicalKeys: true },
], ],
['alt + L', () => jumpToCurrent(), { preventDefault: true, usePhysicalKeys: true }],
[ [
'alt + mod + ArrowDown', 'alt + mod + ArrowDown',
() => commands.moveEntry(cursor, 'down'), () => commands.moveEntry(cursor, 'down'),