-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the disable functionality to dropdowns in the rundown
Signed-off-by: Axel Boberg <[email protected]>
- Loading branch information
1 parent
503d4ab
commit ec4faa8
Showing
3 changed files
with
100 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
import bridge from 'bridge' | ||
|
||
import * as clipboard from './clipboard' | ||
|
||
/** | ||
* Toggle the disabled property | ||
* of the currently selected items | ||
* @returns { Promise.<void> } | ||
*/ | ||
export async function toggleDisableSelection () { | ||
const selection = await bridge.client.getSelection() | ||
|
||
const set = { | ||
items: {} | ||
} | ||
|
||
for (const itemId of selection) { | ||
set.items[itemId] = { | ||
data: { | ||
disabled: { $invert: true } | ||
} | ||
} | ||
} | ||
|
||
bridge.state.apply(set) | ||
} | ||
|
||
/** | ||
* Set the disabled property | ||
* of the currently selected items | ||
* @returns { Promise.<void> } | ||
*/ | ||
export async function disableSelection (disabled) { | ||
const selection = await bridge.client.getSelection() | ||
|
||
const set = { | ||
items: {} | ||
} | ||
|
||
for (const itemId of selection) { | ||
set.items[itemId] = { | ||
data: { | ||
disabled: !!disabled | ||
} | ||
} | ||
} | ||
|
||
bridge.state.apply(set) | ||
} | ||
|
||
/** | ||
* Delete the current selection | ||
* | ||
Check failure on line 53 in plugins/rundown/app/utils/selection.js
|
||
* Fetch the selection from the main thread before doing the deletion as | ||
* we want to make sure we don't delete the wrong items from an unsynced state | ||
* | ||
Check failure on line 56 in plugins/rundown/app/utils/selection.js
|
||
* @returns { Promise.<void> } | ||
*/ | ||
export async function deleteSelection () { | ||
const selection = await bridge.client.getSelection() | ||
bridge.items.deleteItems(selection) | ||
} | ||
|
||
/** | ||
* Copy a string representation of the | ||
* currently selected items to the clipboard | ||
* | ||
Check failure on line 67 in plugins/rundown/app/utils/selection.js
|
||
* @returns { Promise.<void> } | ||
*/ | ||
export async function copySelection () { | ||
const selection = await bridge.client.getSelection() | ||
const str = await bridge.commands.executeCommand('rundown.copyItems', selection) | ||
await clipboard.copyText(str) | ||
} | ||
|
||
/** | ||
* Play the currently selected items | ||
* @returns { Promise.<void> } | ||
*/ | ||
export async function playSelection () { | ||
const selection = await bridge.client.getSelection() | ||
selection.forEach(itemId => bridge.items.playItem(itemId)) | ||
} | ||
|
||
/** | ||
* Stop the currently selected items | ||
* @returns { Promise.<void> } | ||
*/ | ||
export async function stopSelection () { | ||
const selection = await bridge.client.getSelection() | ||
selection.forEach(itemId => bridge.items.stopItem(itemId)) | ||
} |