Skip to content

Commit

Permalink
Move the play and stop functionality to their own functions and get t…
Browse files Browse the repository at this point in the history
…he updated selection before triggering the actions

Signed-off-by: Axel Boberg <[email protected]>
  • Loading branch information
axelboberg committed Feb 18, 2024
1 parent 6bff749 commit a926e48
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions plugins/rundown/app/components/RundownList/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,24 @@ async function copySelection () {
await clipboard.copyText(str)
}

/**
* Play the currently selected items
* @returns { Promise.<void> }
*/
async function playSelection () {
const selection = await bridge.client.getSelection()
selection.forEach(itemId => bridge.items.playItem(itemId))
}

/**
* Stop the currently selected items
* @returns { Promise.<void> }
*/
async function stopSelection () {
const selection = await bridge.client.getSelection()
selection.forEach(itemId => bridge.items.stopItem(itemId))
}

export function RundownList ({
rundownId = '',
className = '',
Expand Down Expand Up @@ -187,10 +205,10 @@ export function RundownList ({
deleteSelection()
break
case 'play':
selection.forEach(itemId => bridge.items.playItem(itemId))
playSelection()
break
case 'stop':
selection.forEach(itemId => bridge.items.stopItem(itemId))
stopSelection()
break
case 'copy':
copySelection()
Expand Down

0 comments on commit a926e48

Please sign in to comment.