Skip to content

🎥 Make videos programmatically with React

Share sequence context menu across Studio surfaces

Jonny Burgerafd684616c62
diff --git a/packages/studio/src/components/SelectedOutlineOverlay.tsx b/packages/studio/src/components/SelectedOutlineOverlay.tsx
index a4b2497f54..6962579f56 100644
--- a/packages/studio/src/components/SelectedOutlineOverlay.tsx
+++ b/packages/studio/src/components/SelectedOutlineOverlay.tsx
@@ -21,6 +21,8 @@ import type {SequenceNodePathInfo} from '../helpers/get-timeline-sequence-sort-k
import {openOriginalPositionInEditor} from '../helpers/open-in-editor';
import {EditorShowOutlinesContext} from '../state/editor-outlines';
import {ScaleLockContext} from '../state/scale-lock';
+import {callApi} from './call-api';
+import {useConfirmationDialog} from './ConfirmationDialog';
import {ContextMenuForTarget} from './ContextMenu';
import {
addEffectFromDragData,
@@ -56,11 +58,14 @@ import {
type AddSequenceKeyframeChange,
} from './Timeline/call-add-keyframe';
import {disableSequenceInteractivity} from './Timeline/disable-sequence-interactivity';
+import {duplicateSequencesFromSource} from './Timeline/duplicate-selected-timeline-item';
+import {getSequenceContextMenuItems} from './Timeline/get-sequence-context-menu-items';
import {parseKeyframeFieldFromNodePath} from './Timeline/parse-keyframe-field-from-node-path';
import {
saveSequenceProps,
type SaveSequencePropChange,
} from './Timeline/save-sequence-prop';
+import {getTimelineAssetLinkInfo} from './Timeline/timeline-asset-link';
import {
parseCssRotationToDegrees,
serializeCssRotation,
@@ -82,6 +87,7 @@ import {
parsedTransformOriginToUv,
serializeTransformOrigin,
} from './Timeline/transform-origin-utils';
+import {useSelectAsset} from './use-select-asset';
type SelectedOutlineContextMenuOpenResult =
| false
@@ -2466,6 +2472,8 @@ const SelectedOutlineElement: React.FC<{
const updateResolvedStackTrace = useContext(
Internals.SequenceStackTracesUpdateContext,
);
+ const confirm = useConfirmationDialog();
+ const selectAsset = useSelectAsset();
const onContextMenuOpen = React.useCallback(async () => {
if (target === undefined || previewServerState.type !== 'connected') {
@@ -2497,91 +2505,108 @@ const SelectedOutlineElement: React.FC<{
location: originalLocation,
root: window.remotion_cwd,
});
- const editorName = window.remotion_editorName;
+ const nodePath = target.nodePathInfo.sequenceSubscriptionKey;
+ const mediaSrc =
+ target.sequence.type === 'audio' ||
+ target.sequence.type === 'video' ||
+ target.sequence.type === 'image'
+ ? target.sequence.src
+ : null;
+ const assetLinkInfo = mediaSrc ? getTimelineAssetLinkInfo(mediaSrc) : null;
+ const canOpenInEditor = Boolean(
+ window.remotion_editorName && originalLocation,
+ );
const disableInteractivityDisabled = !target.sequence.showInTimeline;
+ const sourceEditDisabled =
+ !target.sequence.controls || !nodePath.absolutePath;
+
+ return getSequenceContextMenuItems({
+ assetLinkInfo,
+ canOpenInEditor,
+ deleteDisabled: sourceEditDisabled,
+ disableInteractivityDisabled,
+ duplicateDisabled: sourceEditDisabled,
+ fileLocation,
+ includeSourceEditItems: true,
+ onDeleteSequenceFromSource: async () => {
+ if (sourceEditDisabled || previewServerState.type !== 'connected') {
+ return;
+ }
- return [
- editorName
- ? {
- type: 'item' as const,
- id: 'show-outline-in-editor',
- keyHint: null,
- label: `Show in ${editorName}`,
- leftItem: null,
- disabled: !originalLocation,
- onClick: () => {
- if (!originalLocation) {
- return;
- }
-
- openOriginalPositionInEditor(originalLocation).catch((err) => {
- showNotification((err as Error).message, 2000);
- });
- },
- quickSwitcherLabel: null,
- subMenu: null,
- value: 'show-outline-in-editor',
- }
- : null,
- {
- type: 'item' as const,
- id: 'copy-outline-file-location',
- keyHint: null,
- label: 'Copy file location',
- leftItem: null,
- disabled: !fileLocation,
- onClick: () => {
- if (!fileLocation) {
+ if (target.nodePathInfo.numberOfSequencesWithThisNodePath > 1) {
+ const shouldDelete = await confirm({
+ title: 'Delete sequence?',
+ message:
+ 'This sequence is programmatically duplicated ' +
+ target.nodePathInfo.numberOfSequencesWithThisNodePath +
+ ' times in the code. Deleting removes all instances. Continue?',
+ confirmLabel: 'Delete',
+ });
+ if (!shouldDelete) {
return;
}
+ }
- navigator.clipboard
- .writeText(fileLocation)
- .then(() => {
- showNotification('Copied file location to clipboard', 1000);
- })
- .catch((err) => {
- showNotification(
- `Could not copy to clipboard: ${(err as Error).message}`,
- 1000,
- );
- });
- },
- quickSwitcherLabel: null,
- subMenu: null,
- value: 'copy-outline-file-location',
- },
- {
- type: 'item' as const,
- id: 'disable-outline-interactivity',
- keyHint: null,
- label: 'Disable interactivity',
- leftItem: null,
- disabled: disableInteractivityDisabled,
- onClick: () => {
- if (
- disableInteractivityDisabled ||
- previewServerState.type !== 'connected'
- ) {
- return;
+ try {
+ const result = await callApi('/api/delete-jsx-node', {
+ nodes: [
+ {
+ fileName: nodePath.absolutePath,
+ nodePath: nodePath.nodePath,
+ },
+ ],
+ });
+ if (result.success) {
+ showNotification('Removed sequence from source file', 2000);
+ } else {
+ showNotification(result.reason, 4000);
}
+ } catch (err) {
+ showNotification((err as Error).message, 4000);
+ }
+ },
+ onDisableSequenceInteractivity: () => {
+ if (
+ disableInteractivityDisabled ||
+ previewServerState.type !== 'connected'
+ ) {
+ return;
+ }
- const nodePath = target.nodePathInfo.sequenceSubscriptionKey;
- disableSequenceInteractivity({
- fileName: nodePath.absolutePath,
- nodePath,
- setPropStatuses,
- clientId: previewServerState.clientId,
- });
- },
- quickSwitcherLabel: null,
- subMenu: null,
- value: 'disable-outline-interactivity',
+ disableSequenceInteractivity({
+ fileName: nodePath.absolutePath,
+ nodePath,
+ setPropStatuses,
+ clientId: previewServerState.clientId,
+ });
+ },
+ onDuplicateSequenceFromSource: () => {
+ if (sourceEditDisabled) {
+ return;
+ }
+
+ duplicateSequencesFromSource([target.nodePathInfo], confirm).catch(
+ () => undefined,
+ );
+ },
+ openInEditor: () => {
+ if (!originalLocation) {
+ return;
+ }
+
+ openOriginalPositionInEditor(originalLocation).catch((err) => {
+ showNotification((err as Error).message, 2000);
+ });
},
- ].filter(NoReactInternals.truthy);
+ originalLocation,
+ selectAsset,
+ sequence: target.sequence,
+ });
}, [
+ confirm,
onSelect,
previewServerState,
+ selectAsset,
setPropStatuses,
target,
updateResolvedStackTrace,
diff --git a/packages/studio/src/components/Timeline/TimelineSequence.tsx b/packages/studio/src/components/Timeline/TimelineSequence.tsx
index 88a5005dbb..844f5bbd26 100644
--- a/packages/studio/src/components/Timeline/TimelineSequence.tsx
+++ b/packages/studio/src/components/Timeline/TimelineSequence.tsx
@@ -1,19 +1,31 @@
import React, {useCallback, useContext, useMemo, useRef} from 'react';
import type {TSequence} from 'remotion';
import {Internals, useCurrentFrame} from 'remotion';
+import {StudioServerConnectionCtx} from '../../helpers/client-id';
import {BLUE} from '../../helpers/colors';
+import {formatFileLocation} from '../../helpers/format-file-location';
import {
getTimelineSequenceLayout,
SEQUENCE_BORDER_WIDTH,
} from '../../helpers/get-timeline-sequence-layout';
import type {SequenceNodePathInfo} from '../../helpers/get-timeline-sequence-sort-key';
+import {openOriginalPositionInEditor} from '../../helpers/open-in-editor';
import {
getTimelineLayerHeight,
TIMELINE_LAYER_HEIGHT_AUDIO,
} from '../../helpers/timeline-layout';
import {useMaxMediaDuration} from '../../helpers/use-max-media-duration';
import {AudioWaveform} from '../AudioWaveform';
+import {callApi} from '../call-api';
+import {useConfirmationDialog} from '../ConfirmationDialog';
+import {ContextMenu} from '../ContextMenu';
+import {showNotification} from '../Notifications/NotificationCenter';
+import {useSelectAsset} from '../use-select-asset';
+import {disableSequenceInteractivity} from './disable-sequence-interactivity';
+import {duplicateSequencesFromSource} from './duplicate-selected-timeline-item';
+import {getSequenceContextMenuItems} from './get-sequence-context-menu-items';
import {LoopedTimelineIndicator} from './LoopedTimelineIndicators';
+import {getTimelineAssetLinkInfo} from './timeline-asset-link';
import {TimelineImageInfo} from './TimelineImageInfo';
import {
shouldSelectTimelineRowOnPointerDown,
@@ -250,6 +262,166 @@ const TimelineSequenceInner: React.FC<{
const fromCanUpdate = Boolean(
propStatusesForOverride?.from?.status === 'static',
);
+ const {previewServerState} = useContext(StudioServerConnectionCtx);
+ const previewConnected = previewServerState.type === 'connected';
+ const {setPropStatuses} = useContext(Internals.VisualModeSettersContext);
+ const selectAsset = useSelectAsset();
+ const confirm = useConfirmationDialog();
+ const {onSelect, selectable} = useTimelineRowSelection(nodePathInfo);
+ const fileLocation = useMemo(
+ () =>
+ formatFileLocation({
+ location: originalLocation,
+ root: window.remotion_cwd,
+ }),
+ [originalLocation],
+ );
+ const canOpenInEditor = Boolean(
+ window.remotion_editorName && previewConnected && originalLocation,
+ );
+ const openInEditor = useCallback(() => {
+ if (!canOpenInEditor || !originalLocation) {
+ return;
+ }
+
+ openOriginalPositionInEditor(originalLocation).catch((err) => {
+ showNotification((err as Error).message, 2000);
+ });
+ }, [canOpenInEditor, originalLocation]);
+ const canDeleteFromSource = Boolean(nodePath && validatedLocation?.source);
+ const deleteDisabled =
+ !previewConnected || !s.controls || !canDeleteFromSource;
+ const duplicateDisabled = deleteDisabled;
+ const disableInteractivityDisabled =
+ !previewConnected ||
+ !s.showInTimeline ||
+ !nodePath ||
+ !validatedLocation?.source;
+ const mediaSrc =
+ s.type === 'audio' || s.type === 'video' || s.type === 'image'
+ ? s.src
+ : null;
+ const assetLinkInfo = useMemo(
+ () => (mediaSrc ? getTimelineAssetLinkInfo(mediaSrc) : null),
+ [mediaSrc],
+ );
+ const onDuplicateSequenceFromSource = useCallback(() => {
+ if (!validatedLocation?.source || !nodePathInfo || duplicateDisabled) {
+ return;
+ }
+
+ duplicateSequencesFromSource([nodePathInfo], confirm).catch(
+ () => undefined,
+ );
+ }, [confirm, duplicateDisabled, nodePathInfo, validatedLocation?.source]);
+ const onDeleteSequenceFromSource = useCallback(async () => {
+ if (!validatedLocation?.source || !nodePath || deleteDisabled) {
+ return;
+ }
+
+ if (nodePathInfo && nodePathInfo.numberOfSequencesWithThisNodePath > 1) {
+ const shouldDelete = await confirm({
+ title: 'Delete sequence?',
+ message:
+ 'This sequence is programmatically duplicated ' +
+ nodePathInfo.numberOfSequencesWithThisNodePath +
+ ' times in the code. Deleting removes all instances. Continue?',
+ confirmLabel: 'Delete',
+ });
+ if (!shouldDelete) {
+ return;
+ }
+ }
+
+ try {
+ const result = await callApi('/api/delete-jsx-node', {
+ nodes: [
+ {
+ fileName: validatedLocation.source,
+ nodePath: nodePath.nodePath,
+ },
+ ],
+ });
+ if (result.success) {
+ showNotification('Removed sequence from source file', 2000);
+ } else {
+ showNotification(result.reason, 4000);
+ }
+ } catch (err) {
+ showNotification((err as Error).message, 4000);
+ }
+ }, [
+ confirm,
+ deleteDisabled,
+ nodePath,
+ nodePathInfo,
+ validatedLocation?.source,
+ ]);
+ const onDisableSequenceInteractivity = useCallback(() => {
+ if (
+ disableInteractivityDisabled ||
+ !nodePath ||
+ !validatedLocation?.source ||
+ previewServerState.type !== 'connected'
+ ) {
+ return;
+ }
+
+ disableSequenceInteractivity({
+ fileName: validatedLocation.source,
+ nodePath,
+ setPropStatuses,
+ clientId: previewServerState.clientId,
+ });
+ }, [
+ disableInteractivityDisabled,
+ nodePath,
+ previewServerState,
+ setPropStatuses,
+ validatedLocation?.source,
+ ]);
+ const contextMenuValues = useMemo(() => {
+ if (!previewConnected) {
+ return [];
+ }
+
+ return getSequenceContextMenuItems({
+ assetLinkInfo,
+ canOpenInEditor,
+ deleteDisabled,
+ disableInteractivityDisabled,
+ duplicateDisabled,
+ fileLocation,
+ includeSourceEditItems: true,
+ onDeleteSequenceFromSource,
+ onDisableSequenceInteractivity,
+ onDuplicateSequenceFromSource,
+ openInEditor,
+ originalLocation,
+ selectAsset,
+ sequence: s,
+ });
+ }, [
+ assetLinkInfo,
+ canOpenInEditor,
+ deleteDisabled,
+ disableInteractivityDisabled,
+ duplicateDisabled,
+ fileLocation,
+ onDeleteSequenceFromSource,
+ onDisableSequenceInteractivity,
+ onDuplicateSequenceFromSource,
+ openInEditor,
+ originalLocation,
+ previewConnected,
+ s,
+ selectAsset,
+ ]);
+ const onContextMenuOpen = useCallback(() => {
+ if (selectable) {
+ onSelect({shiftKey: false, toggleKey: false});
+ }
+ }, [onSelect, selectable]);
const {onPointerDown: onMoveDragPointerDown} = useTimelineSequenceFromDrag({
nodePathInfo,
@@ -319,7 +491,7 @@ const TimelineSequenceInner: React.FC<{
return null;
}
- return (
+ const sequence = (
<TimelineSequenceCurrentFrame
s={s}
displayDurationInFrames={displayDurationInFrames}
@@ -374,6 +546,14 @@ const TimelineSequenceInner: React.FC<{
) : null}
</TimelineSequenceCurrentFrame>
);
+
+ return previewConnected ? (
+ <ContextMenu values={contextMenuValues} onOpen={onContextMenuOpen}>
+ {sequence}
+ </ContextMenu>
+ ) : (
+ sequence
+ );
};
export const TimelineSequence = React.memo(TimelineSequenceFn);
diff --git a/packages/studio/src/components/Timeline/TimelineSequenceItem.tsx b/packages/studio/src/components/Timeline/TimelineSequenceItem.tsx
index 53cadcbcdd..b96f1fd2a5 100644
--- a/packages/studio/src/components/Timeline/TimelineSequenceItem.tsx
+++ b/packages/studio/src/components/Timeline/TimelineSequenceItem.tsx
@@ -2,7 +2,6 @@ import {type ReorderSequencePosition} from '@remotion/studio-shared';
import React, {useCallback, useContext, useMemo, useState} from 'react';
import type {SequencePropsSubscriptionKey, TSequence} from 'remotion';
import {Internals} from 'remotion';
-import {NoReactInternals} from 'remotion/no-react';
import {StudioServerConnectionCtx} from '../../helpers/client-id';
import {formatFileLocation} from '../../helpers/format-file-location';
import type {SequenceNodePathInfo} from '../../helpers/get-timeline-sequence-sort-key';
@@ -25,16 +24,13 @@ import {
ExpandedTracksSetterContext,
} from '../ExpandedTracksProvider';
import {Spacing} from '../layout';
-import type {ComboboxValue} from '../NewComposition/ComboBox';
import {showNotification} from '../Notifications/NotificationCenter';
import {useSelectAsset} from '../use-select-asset';
import {disableSequenceInteractivity} from './disable-sequence-interactivity';
import {duplicateSequencesFromSource} from './duplicate-selected-timeline-item';
+import {getSequenceContextMenuItems} from './get-sequence-context-menu-items';
import {saveSequenceProps} from './save-sequence-prop';
-import {
- getTimelineAssetLinkInfo,
- openTimelineAssetLink,
-} from './timeline-asset-link';
+import {getTimelineAssetLinkInfo} from './timeline-asset-link';
import {
TimelineExpandArrowButton,
TimelineExpandArrowSpacer,
@@ -544,150 +540,30 @@ export const TimelineSequenceItem: React.FC<{
[mediaSrc],
);
- const contextMenuValues = useMemo((): ComboboxValue[] => {
+ const contextMenuValues = useMemo(() => {
if (!previewConnected) {
return [];
}
- const editorName = window.remotion_editorName;
- const {documentationLink} = sequence;
-
- return [
- editorName
- ? {
- type: 'item' as const,
- id: 'show-in-editor',
- keyHint: null,
- label: `Show in ${editorName}`,
- leftItem: null,
- disabled: !canOpenInEditor,
- onClick: () => {
- openInEditor();
- },
- quickSwitcherLabel: null,
- subMenu: null,
- value: 'show-in-editor',
- }
- : null,
- {
- type: 'item' as const,
- id: 'copy-file-location',
- keyHint: null,
- label: 'Copy file location',
- leftItem: null,
- disabled: !fileLocation,
- onClick: () => {
- if (!fileLocation) {
- return;
- }
-
- navigator.clipboard
- .writeText(fileLocation)
- .then(() => {
- showNotification('Copied file location to clipboard', 1000);
- })
- .catch((err) => {
- showNotification(
- `Could not copy to clipboard: ${(err as Error).message}`,
- 1000,
- );
- });
- },
- quickSwitcherLabel: null,
- subMenu: null,
- value: 'copy-file-location',
- },
- documentationLink
- ? {
- type: 'item' as const,
- id: 'open-component-docs',
- keyHint: null,
- label: 'Open component docs',
- leftItem: null,
- disabled: false,
- onClick: () => {
- window.open(documentationLink, '_blank', 'noopener,noreferrer');
- },
- quickSwitcherLabel: null,
- subMenu: null,
- value: 'open-component-docs',
- }
- : null,
- assetLinkInfo
- ? {
- type: 'item' as const,
- id: 'show-asset',
- keyHint: null,
- label: 'Show asset',
- leftItem: null,
- disabled: false,
- onClick: () => {
- openTimelineAssetLink(assetLinkInfo, selectAsset);
- },
- quickSwitcherLabel: null,
- subMenu: null,
- value: 'show-asset',
- }
- : null,
- documentationLink
- ? {
- type: 'divider' as const,
- id: 'open-component-docs-divider',
- }
- : null,
- {
- type: 'item' as const,
- id: 'disable-interactivity',
- keyHint: null,
- label: 'Disable interactivity',
- leftItem: null,
- disabled: disableInteractivityDisabled,
- onClick: () => {
- onDisableSequenceInteractivity();
- },
- quickSwitcherLabel: null,
- subMenu: null,
- value: 'disable-interactivity',
- },
- {
- type: 'item' as const,
- id: 'duplicate-sequence',
- keyHint: null,
- label: 'Duplicate',
- leftItem: null,
- disabled: duplicateDisabled,
- onClick: () => {
- if (duplicateDisabled) {
- return;
- }
-
- onDuplicateSequenceFromSource();
- },
- quickSwitcherLabel: null,
- subMenu: null,
- value: 'duplicate-sequence',
- },
- {
- type: 'item' as const,
- id: 'delete-sequence',
- keyHint: null,
- label: 'Delete',
- leftItem: null,
- disabled: deleteDisabled,
- onClick: () => {
- if (deleteDisabled) {
- return;
- }
-
- onDeleteSequenceFromSource();
- },
- quickSwitcherLabel: null,
- subMenu: null,
- value: 'delete-sequence',
- },
- ].filter(NoReactInternals.truthy);
+ return getSequenceContextMenuItems({
+ assetLinkInfo,
+ canOpenInEditor,
+ deleteDisabled,
+ disableInteractivityDisabled,
+ duplicateDisabled,
+ fileLocation,
+ includeSourceEditItems: true,
+ onDeleteSequenceFromSource,
+ onDisableSequenceInteractivity,
+ onDuplicateSequenceFromSource,
+ openInEditor,
+ originalLocation,
+ selectAsset,
+ sequence,
+ });
}, [
assetLinkInfo,
+ canOpenInEditor,
deleteDisabled,
disableInteractivityDisabled,
duplicateDisabled,
@@ -695,8 +571,8 @@ export const TimelineSequenceItem: React.FC<{
onDeleteSequenceFromSource,
onDisableSequenceInteractivity,
onDuplicateSequenceFromSource,
- canOpenInEditor,
openInEditor,
+ originalLocation,
previewConnected,
selectAsset,
sequence,
diff --git a/packages/studio/src/components/Timeline/get-sequence-context-menu-items.ts b/packages/studio/src/components/Timeline/get-sequence-context-menu-items.ts
new file mode 100644
index 0000000000..318a568b55
--- /dev/null
+++ b/packages/studio/src/components/Timeline/get-sequence-context-menu-items.ts
@@ -0,0 +1,164 @@
+import type {ResolvedStackLocation, TSequence} from 'remotion';
+import {NoReactInternals} from 'remotion/no-react';
+import type {ComboboxValue} from '../NewComposition/ComboBox';
+import {showNotification} from '../Notifications/NotificationCenter';
+import type {TimelineAssetLinkInfo} from './timeline-asset-link';
+import {openTimelineAssetLink} from './timeline-asset-link';
+
+export const getSequenceContextMenuItems = ({
+ assetLinkInfo,
+ canOpenInEditor,
+ deleteDisabled,
+ disableInteractivityDisabled,
+ duplicateDisabled,
+ fileLocation,
+ includeSourceEditItems,
+ onDeleteSequenceFromSource,
+ onDisableSequenceInteractivity,
+ onDuplicateSequenceFromSource,
+ openInEditor,
+ originalLocation,
+ selectAsset,
+ sequence,
+}: {
+ readonly assetLinkInfo: TimelineAssetLinkInfo | null;
+ readonly canOpenInEditor: boolean;
+ readonly deleteDisabled: boolean;
+ readonly disableInteractivityDisabled: boolean;
+ readonly duplicateDisabled: boolean;
+ readonly fileLocation: string | null;
+ readonly includeSourceEditItems: boolean;
+ readonly onDeleteSequenceFromSource: () => void;
+ readonly onDisableSequenceInteractivity: () => void;
+ readonly onDuplicateSequenceFromSource: () => void;
+ readonly openInEditor: () => void;
+ readonly originalLocation: ResolvedStackLocation | null;
+ readonly selectAsset: (src: string) => void;
+ readonly sequence: TSequence;
+}): ComboboxValue[] => {
+ const editorName = window.remotion_editorName;
+ const {documentationLink} = sequence;
+
+ return [
+ editorName
+ ? {
+ type: 'item' as const,
+ id: 'show-in-editor',
+ keyHint: null,
+ label: `Show in ${editorName}`,
+ leftItem: null,
+ disabled: !canOpenInEditor || !originalLocation,
+ onClick: openInEditor,
+ quickSwitcherLabel: null,
+ subMenu: null,
+ value: 'show-in-editor',
+ }
+ : null,
+ {
+ type: 'item' as const,
+ id: 'copy-file-location',
+ keyHint: null,
+ label: 'Copy file location',
+ leftItem: null,
+ disabled: !fileLocation,
+ onClick: () => {
+ if (!fileLocation) {
+ return;
+ }
+
+ navigator.clipboard
+ .writeText(fileLocation)
+ .then(() => {
+ showNotification('Copied file location to clipboard', 1000);
+ })
+ .catch((err) => {
+ showNotification(
+ `Could not copy to clipboard: ${(err as Error).message}`,
+ 1000,
+ );
+ });
+ },
+ quickSwitcherLabel: null,
+ subMenu: null,
+ value: 'copy-file-location',
+ },
+ documentationLink
+ ? {
+ type: 'item' as const,
+ id: 'open-component-docs',
+ keyHint: null,
+ label: 'Open component docs',
+ leftItem: null,
+ disabled: false,
+ onClick: () => {
+ window.open(documentationLink, '_blank', 'noopener,noreferrer');
+ },
+ quickSwitcherLabel: null,
+ subMenu: null,
+ value: 'open-component-docs',
+ }
+ : null,
+ assetLinkInfo
+ ? {
+ type: 'item' as const,
+ id: 'show-asset',
+ keyHint: null,
+ label: 'Show asset',
+ leftItem: null,
+ disabled: false,
+ onClick: () => {
+ openTimelineAssetLink(assetLinkInfo, selectAsset);
+ },
+ quickSwitcherLabel: null,
+ subMenu: null,
+ value: 'show-asset',
+ }
+ : null,
+ documentationLink || assetLinkInfo
+ ? {
+ type: 'divider' as const,
+ id: 'sequence-link-divider',
+ }
+ : null,
+ {
+ type: 'item' as const,
+ id: 'disable-interactivity',
+ keyHint: null,
+ label: 'Disable interactivity',
+ leftItem: null,
+ disabled: disableInteractivityDisabled,
+ onClick: onDisableSequenceInteractivity,
+ quickSwitcherLabel: null,
+ subMenu: null,
+ value: 'disable-interactivity',
+ },
+ includeSourceEditItems
+ ? {
+ type: 'item' as const,
+ id: 'duplicate-sequence',
+ keyHint: null,
+ label: 'Duplicate',
+ leftItem: null,
+ disabled: duplicateDisabled,
+ onClick: onDuplicateSequenceFromSource,
+ quickSwitcherLabel: null,
+ subMenu: null,
+ value: 'duplicate-sequence',
+ }
+ : null,
+ includeSourceEditItems
+ ? {
+ type: 'item' as const,
+ id: 'delete-sequence',
+ keyHint: null,
+ label: 'Delete',
+ leftItem: null,
+ disabled: deleteDisabled,
+ onClick: onDeleteSequenceFromSource,
+ quickSwitcherLabel: null,
+ subMenu: null,
+ value: 'delete-sequence',
+ }
+ : null,
+ ].filter(NoReactInternals.truthy);
+};