Skip to content

🎥 Make videos programmatically with React

`@remotion/studio`: Keep context menu actions in consistent groups

JonnyBurger28cc9add4f48
diff --git a/packages/studio/src/components/SelectedOutlineElement.tsx b/packages/studio/src/components/SelectedOutlineElement.tsx
index 3e232a99d6..4ece70f617 100644
--- a/packages/studio/src/components/SelectedOutlineElement.tsx
+++ b/packages/studio/src/components/SelectedOutlineElement.tsx
@@ -422,107 +422,107 @@ const SelectedOutlineElementUnmemoized: React.FC<
selectAsset,
sequence: contextMenuTarget.sequence,
sourceActions: sourceEditingEnabled
- ? [
- ...(unwrapMenuItem ? [unwrapMenuItem] : []),
- ...(contextMenuTarget.nodePathInfo.supportsEffects
- ? [
- {
- type: 'item' as const,
- id: 'add-effect',
- keyHint: null,
- label: 'Add effect...',
- leftItem: null,
- disabled: !canAddEffect,
- onClick: () => {
- if (
- !canAddEffect ||
- previewServerState.type !== 'connected'
- ) {
- return;
- }
+ ? {
+ rename: null,
+ timing: [],
+ appearance: [
+ {
+ type: 'item' as const,
+ id: 'crop',
+ keyHint: null,
+ label: isProgrammaticallyDuplicated ? 'Crop all' : 'Crop',
+ leftItem: null,
+ disabled: !canCrop,
+ onClick: () => {
+ if (!canCrop) {
+ return;
+ }
- setSelectedModal({
- type: 'add-effect',
- clientId: previewServerState.clientId,
- fileName: nodePath.absolutePath,
- nodePathInfo: contextMenuTarget.nodePathInfo,
- selectItems: currentSelection.current.selectItems,
- });
+ onSelect(
+ {
+ type: 'sequence-prop',
+ nodePathInfo: {
+ ...contextMenuTarget.nodePathInfo,
+ auxiliaryKeys: ['controls', cropFieldKeys.left],
+ },
+ key: cropFieldKeys.left,
},
- quickSwitcherLabel: null,
- subMenu: null,
- value: 'add-effect',
- },
- ]
- : []),
- {
- type: 'item' as const,
- id: 'crop',
- keyHint: null,
- label: isProgrammaticallyDuplicated ? 'Crop all' : 'Crop',
- leftItem: null,
- disabled: !canCrop,
- onClick: () => {
- if (!canCrop) {
- return;
- }
+ {shiftKey: false, toggleKey: false},
+ );
+ },
+ quickSwitcherLabel: null,
+ subMenu: null,
+ value: 'crop',
+ },
+ {
+ type: 'item' as const,
+ id: 'rotate',
+ keyHint: null,
+ label: isProgrammaticallyDuplicated ? 'Rotate all' : 'Rotate',
+ leftItem: null,
+ disabled: !canRotate,
+ onClick: () => {
+ if (!canRotate) {
+ return;
+ }
- onSelect(
- {
- type: 'sequence-prop',
- nodePathInfo: {
- ...contextMenuTarget.nodePathInfo,
- auxiliaryKeys: ['controls', cropFieldKeys.left],
+ setManuallyEnabled(
+ getTimelineSequenceSelectionKey(
+ contextMenuTarget.nodePathInfo,
+ ),
+ true,
+ );
+ onSelect(
+ {
+ type: 'sequence-prop',
+ nodePathInfo: {
+ ...contextMenuTarget.nodePathInfo,
+ auxiliaryKeys: ['controls', rotateFieldKey],
+ },
+ key: rotateFieldKey,
},
- key: cropFieldKeys.left,
- },
- {shiftKey: false, toggleKey: false},
- );
+ {shiftKey: false, toggleKey: false},
+ );
+ },
+ quickSwitcherLabel: null,
+ subMenu: null,
+ value: 'rotate',
},
- quickSwitcherLabel: null,
- subMenu: null,
- value: 'crop',
- },
- {
- type: 'item' as const,
- id: 'rotate',
- keyHint: null,
- label: isProgrammaticallyDuplicated ? 'Rotate all' : 'Rotate',
- leftItem: null,
- disabled: !canRotate,
- onClick: () => {
- if (!canRotate) {
- return;
- }
+ ...(contextMenuTarget.nodePathInfo.supportsEffects
+ ? [
+ {
+ type: 'item' as const,
+ id: 'add-effect',
+ keyHint: null,
+ label: 'Add effect...',
+ leftItem: null,
+ disabled: !canAddEffect,
+ onClick: () => {
+ if (
+ !canAddEffect ||
+ previewServerState.type !== 'connected'
+ ) {
+ return;
+ }
- setManuallyEnabled(
- getTimelineSequenceSelectionKey(
- contextMenuTarget.nodePathInfo,
- ),
- true,
- );
- onSelect(
- {
- type: 'sequence-prop',
- nodePathInfo: {
- ...contextMenuTarget.nodePathInfo,
- auxiliaryKeys: ['controls', rotateFieldKey],
+ setSelectedModal({
+ type: 'add-effect',
+ clientId: previewServerState.clientId,
+ fileName: nodePath.absolutePath,
+ nodePathInfo: contextMenuTarget.nodePathInfo,
+ selectItems: currentSelection.current.selectItems,
+ });
+ },
+ quickSwitcherLabel: null,
+ subMenu: null,
+ value: 'add-effect',
},
- key: rotateFieldKey,
- },
- {shiftKey: false, toggleKey: false},
- );
- },
- quickSwitcherLabel: null,
- subMenu: null,
- value: 'rotate',
- },
- {
- type: 'divider' as const,
- id: 'rotate-divider',
- },
- ]
- : [],
+ ]
+ : []),
+ ],
+ unwrap: unwrapMenuItem,
+ }
+ : null,
});
}, [
canConfigureApps,
diff --git a/packages/studio/src/components/Timeline/TimelineEffectItem.tsx b/packages/studio/src/components/Timeline/TimelineEffectItem.tsx
index 9a09818610..83625a2153 100644
--- a/packages/studio/src/components/Timeline/TimelineEffectItem.tsx
+++ b/packages/studio/src/components/Timeline/TimelineEffectItem.tsx
@@ -239,6 +239,24 @@ export const TimelineEffectItem: React.FC<{
}
const items: ComboboxValue[] = [
+ ...(previewConnected && documentationLink
+ ? [
+ {
+ type: 'item' as const,
+ id: 'open-effect-docs',
+ keyHint: null,
+ label: 'Open effect docs',
+ leftItem: null,
+ disabled: false,
+ onClick: () => {
+ window.open(documentationLink, '_blank', 'noopener,noreferrer');
+ },
+ quickSwitcherLabel: null,
+ subMenu: null,
+ value: 'open-effect-docs',
+ },
+ ]
+ : []),
getCopyContextForAgentsMenuItem({
contextForAgents: formatContextForAgents({
location: validatedLocation,
@@ -273,27 +291,6 @@ export const TimelineEffectItem: React.FC<{
id: 'copy-context-for-agents-divider',
});
- if (documentationLink) {
- items.push({
- type: 'item',
- id: 'open-effect-docs',
- keyHint: null,
- label: 'Open effect docs',
- leftItem: null,
- disabled: false,
- onClick: () => {
- window.open(documentationLink, '_blank', 'noopener,noreferrer');
- },
- quickSwitcherLabel: null,
- subMenu: null,
- value: 'open-effect-docs',
- });
- items.push({
- type: 'divider',
- id: 'open-effect-docs-divider',
- });
- }
-
items.push({
type: 'item',
id: 'delete-effect',
diff --git a/packages/studio/src/components/Timeline/TimelineKeyframeEasingLine.tsx b/packages/studio/src/components/Timeline/TimelineKeyframeEasingLine.tsx
index 4ccdf79507..c79fd87644 100644
--- a/packages/studio/src/components/Timeline/TimelineKeyframeEasingLine.tsx
+++ b/packages/studio/src/components/Timeline/TimelineKeyframeEasingLine.tsx
@@ -177,6 +177,26 @@ const TimelineKeyframeEasingLineInteraction: React.FC<
const stack = track?.sequence.getStack() ?? null;
return [
+ getCopyContextForAgentsMenuItem({
+ contextForAgents:
+ field === null || stack === null
+ ? null
+ : async () => {
+ const location = await getOriginalLocationFromStack(
+ stack,
+ 'sequence',
+ );
+ return formatContextForAgents({
+ location,
+ name: `${field.type === 'effect' ? 'Effect property' : 'Property'} "${field.fieldKey}", easing from frame ${fromFrame} to ${toFrame}`,
+ root: window.remotion_cwd,
+ });
+ },
+ }),
+ {
+ type: 'divider',
+ id: 'copy-context-for-agents-divider',
+ },
...canvasKeyframeEasingPresets.map((preset) => ({
type: 'item' as const,
id: preset.id,
@@ -198,26 +218,6 @@ const TimelineKeyframeEasingLineInteraction: React.FC<
subMenu: null,
value: preset.id,
})),
- {
- type: 'divider',
- id: 'copy-context-for-agents-divider',
- },
- getCopyContextForAgentsMenuItem({
- contextForAgents:
- field === null || stack === null
- ? null
- : async () => {
- const location = await getOriginalLocationFromStack(
- stack,
- 'sequence',
- );
- return formatContextForAgents({
- location,
- name: `${field.type === 'effect' ? 'Effect property' : 'Property'} "${field.fieldKey}", easing from frame ${fromFrame} to ${toFrame}`,
- root: window.remotion_cwd,
- });
- },
- }),
];
},
[
diff --git a/packages/studio/src/components/Timeline/TimelineSequence.tsx b/packages/studio/src/components/Timeline/TimelineSequence.tsx
index 1b1555d82b..fbc8364fc4 100644
--- a/packages/studio/src/components/Timeline/TimelineSequence.tsx
+++ b/packages/studio/src/components/Timeline/TimelineSequence.tsx
@@ -1753,12 +1753,16 @@ const useTimelineSequenceState = (props: TimelineSequenceProps) => {
selectAsset,
sequence: s,
sourceActions: isStudioInteractivityEnabled()
- ? [
- ...(unwrapMenuItem ? [unwrapMenuItem] : []),
- ...(splitMenuItem ? [splitMenuItem] : []),
- ...(freezeFrameMenuItem ? [freezeFrameMenuItem] : []),
- ]
- : [],
+ ? {
+ rename: null,
+ timing: [
+ ...(splitMenuItem ? [splitMenuItem] : []),
+ ...(freezeFrameMenuItem ? [freezeFrameMenuItem] : []),
+ ],
+ appearance: [],
+ unwrap: unwrapMenuItem,
+ }
+ : null,
},
contextMenuTarget,
);
diff --git a/packages/studio/src/components/Timeline/TimelineSequenceItem.tsx b/packages/studio/src/components/Timeline/TimelineSequenceItem.tsx
index 82c5beb782..2c11738842 100644
--- a/packages/studio/src/components/Timeline/TimelineSequenceItem.tsx
+++ b/packages/studio/src/components/Timeline/TimelineSequenceItem.tsx
@@ -1477,68 +1477,8 @@ const TimelineSequenceItemInner: React.FC<{
selectAsset,
sequence,
sourceActions: isStudioInteractivityEnabled()
- ? [
- ...(nodePathInfo?.supportsEffects
- ? [
- {
- type: 'item' as const,
- id: 'add-effect',
- keyHint: null,
- label: 'Add effect...',
- leftItem: null,
- disabled: !canAddEffect,
- onClick: onAddEffect,
- quickSwitcherLabel: null,
- subMenu: null,
- value: 'add-effect',
- },
- ]
- : []),
- ...(canCrop
- ? [
- {
- type: 'item' as const,
- id: 'crop',
- keyHint: null,
- label: isProgrammaticallyDuplicated
- ? 'Crop all'
- : 'Crop',
- leftItem: null,
- disabled: false,
- onClick: onCrop,
- quickSwitcherLabel: null,
- subMenu: null,
- value: 'crop',
- },
- ]
- : []),
- ...(canRotate
- ? [
- {
- type: 'item' as const,
- id: 'rotate',
- keyHint: null,
- label: isProgrammaticallyDuplicated
- ? 'Rotate all'
- : 'Rotate',
- leftItem: null,
- disabled: false,
- onClick: onRotate,
- quickSwitcherLabel: null,
- subMenu: null,
- value: 'rotate',
- },
- ]
- : []),
- ...(canCrop || canRotate
- ? [
- {
- type: 'divider' as const,
- id: 'transform-controls-divider',
- },
- ]
- : []),
- {
+ ? {
+ rename: {
type: 'item' as const,
id: 'rename-sequence',
keyHint: null,
@@ -1552,13 +1492,69 @@ const TimelineSequenceItemInner: React.FC<{
subMenu: null,
value: 'rename-sequence',
},
- ...(unwrapMenuItem ? [unwrapMenuItem] : []),
- ...(!isPackedTrack && splitMenuItem ? [splitMenuItem] : []),
- ...(!isPackedTrack && freezeFrameMenuItem
- ? [freezeFrameMenuItem]
- : []),
- ]
- : [],
+ timing: [
+ ...(!isPackedTrack && splitMenuItem ? [splitMenuItem] : []),
+ ...(!isPackedTrack && freezeFrameMenuItem
+ ? [freezeFrameMenuItem]
+ : []),
+ ],
+ appearance: [
+ ...(canCrop
+ ? [
+ {
+ type: 'item' as const,
+ id: 'crop',
+ keyHint: null,
+ label: isProgrammaticallyDuplicated
+ ? 'Crop all'
+ : 'Crop',
+ leftItem: null,
+ disabled: false,
+ onClick: onCrop,
+ quickSwitcherLabel: null,
+ subMenu: null,
+ value: 'crop',
+ },
+ ]
+ : []),
+ ...(canRotate
+ ? [
+ {
+ type: 'item' as const,
+ id: 'rotate',
+ keyHint: null,
+ label: isProgrammaticallyDuplicated
+ ? 'Rotate all'
+ : 'Rotate',
+ leftItem: null,
+ disabled: false,
+ onClick: onRotate,
+ quickSwitcherLabel: null,
+ subMenu: null,
+ value: 'rotate',
+ },
+ ]
+ : []),
+ ...(nodePathInfo?.supportsEffects
+ ? [
+ {
+ type: 'item' as const,
+ id: 'add-effect',
+ keyHint: null,
+ label: 'Add effect...',
+ leftItem: null,
+ disabled: !canAddEffect,
+ onClick: onAddEffect,
+ quickSwitcherLabel: null,
+ subMenu: null,
+ value: 'add-effect',
+ },
+ ]
+ : []),
+ ],
+ unwrap: unwrapMenuItem,
+ }
+ : null,
},
contextMenuTarget,
);
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
index 94e2d9cdf0..56363d76be 100644
--- a/packages/studio/src/components/Timeline/get-sequence-context-menu-items.ts
+++ b/packages/studio/src/components/Timeline/get-sequence-context-menu-items.ts
@@ -212,7 +212,7 @@ export const getSequenceContextMenuItems = (
originalLocation,
selectAsset,
sequence,
- sourceActions = [],
+ sourceActions,
}: {
readonly assetLinkInfo: TimelineAssetLinkInfo | null;
readonly canOpenInEditor: boolean;
@@ -237,7 +237,12 @@ export const getSequenceContextMenuItems = (
readonly originalLocation: ResolvedStackLocation | null;
readonly selectAsset: (src: string) => void;
readonly sequence: TSequence;
- readonly sourceActions?: readonly ComboboxValue[];
+ readonly sourceActions: {
+ readonly rename: ComboboxValue | null;
+ readonly timing: readonly ComboboxValue[];
+ readonly appearance: readonly ComboboxValue[];
+ readonly unwrap: ComboboxValue | null;
+ } | null;
},
contextMenuTarget: HTMLElement | null = null,
): ComboboxValue[] => {
@@ -456,47 +461,53 @@ export const getSequenceContextMenuItems = (
id: 'copy-svg-divider',
}
: null,
- sourceActions.length > 0
- ? {
- type: 'divider' as const,
- id: 'sequence-source-actions-divider',
- }
+ includeSourceEditItems || sourceActions
+ ? {type: 'divider' as const, id: 'sequence-source-actions-divider'}
: null,
- ...sourceActions,
+ sourceActions?.rename,
includeSourceEditItems
? {
type: 'item' as const,
- id: 'disable-interactivity',
+ id: 'duplicate-sequence',
keyHint: null,
- label: 'Disable interactivity',
+ label: 'Duplicate',
leftItem: null,
- disabled: disableInteractivityDisabled,
- onClick: onDisableSequenceInteractivity,
+ disabled: duplicateDisabled || isProgrammaticallyDuplicated,
+ onClick: onDuplicateSequenceFromSource,
quickSwitcherLabel: null,
subMenu: null,
- value: 'disable-interactivity',
+ value: 'duplicate-sequence',
}
: null,
+ ...(sourceActions?.timing ?? []),
+ sourceActions && sourceActions.appearance.length > 0
+ ? {type: 'divider' as const, id: 'sequence-appearance-divider'}
+ : null,
+ ...(sourceActions?.appearance ?? []),
+ includeSourceEditItems
+ ? {type: 'divider' as const, id: 'sequence-interactivity-divider'}
+ : null,
includeSourceEditItems
? {
type: 'item' as const,
- id: 'duplicate-sequence',
+ id: 'disable-interactivity',
keyHint: null,
- label: 'Duplicate',
+ label: 'Disable interactivity',
leftItem: null,
- disabled: duplicateDisabled || isProgrammaticallyDuplicated,
- onClick: onDuplicateSequenceFromSource,
+ disabled: disableInteractivityDisabled,
+ onClick: onDisableSequenceInteractivity,
quickSwitcherLabel: null,
subMenu: null,
- value: 'duplicate-sequence',
+ value: 'disable-interactivity',
}
: null,
includeSourceEditItems
? {
type: 'divider' as const,
- id: 'sequence-duplicate-delete-divider',
+ id: 'sequence-delete-divider',
}
: null,
+ sourceActions?.unwrap,
includeSourceEditItems
? {
type: 'item' as const,
diff --git a/packages/studio/src/components/asset-context-menu.ts b/packages/studio/src/components/asset-context-menu.ts
index d1ae125738..7d8830603b 100644
--- a/packages/studio/src/components/asset-context-menu.ts
+++ b/packages/studio/src/components/asset-context-menu.ts
@@ -81,6 +81,20 @@ export const getAssetContextMenuItems = ({
value: 'open-asset-in-convert',
}
: null,
+ fileExplorerAvailable
+ ? {
+ id: 'open-asset-in-explorer',
+ keyHint: null,
+ label: `Show in ${fileManagerName}`,
+ leftItem: null,
+ onClick: openAssetInExplorer,
+ quickSwitcherLabel: `Show asset in ${fileManagerName}`,
+ subMenu: null,
+ type: 'item',
+ value: 'open-asset-in-explorer',
+ disabled: fileExplorerDisabled,
+ }
+ : null,
{
type: 'divider',
id: 'open-in-new-window-divider',
@@ -124,20 +138,6 @@ export const getAssetContextMenuItems = ({
type: 'divider',
id: 'asset-file-actions-divider',
},
- fileExplorerAvailable
- ? {
- id: 'open-asset-in-explorer',
- keyHint: null,
- label: `Show in ${fileManagerName}`,
- leftItem: null,
- onClick: openAssetInExplorer,
- quickSwitcherLabel: `Show asset in ${fileManagerName}`,
- subMenu: null,
- type: 'item',
- value: 'open-asset-in-explorer',
- disabled: fileExplorerDisabled,
- }
- : null,
{
id: 'rename-asset',
keyHint: null,
diff --git a/packages/studio/src/components/composition-menu-items.ts b/packages/studio/src/components/composition-menu-items.ts
index 041a42048d..12135d4451 100644
--- a/packages/studio/src/components/composition-menu-items.ts
+++ b/packages/studio/src/components/composition-menu-items.ts
@@ -223,10 +223,6 @@ export const getCompositionMenuItems = ({
openComponentInGitSource().catch(() => undefined);
},
});
- const hasOpenInItems =
- defaultOpenInName !== null ||
- compositionOpenInMenuItems.length > 0 ||
- componentOpenInMenuItems.length > 0;
return [
defaultOpenInTarget && defaultOpenInName
@@ -324,92 +320,6 @@ export const getCompositionMenuItems = ({
value: 'open-component-in-another-app',
}
: null,
- hasOpenInItems && includeCompositionManagementItems
- ? {
- type: 'divider' as const,
- id: 'show-in-editor-divider',
- }
- : null,
- includeCompositionManagementItems
- ? {
- id: 'rename',
- keyHint: null,
- label: `Rename...`,
- leftItem: null,
- onClick: () => {
- if (!composition) {
- return;
- }
-
- closeMenu();
- setSelectedModal({
- type: 'rename-comp',
- compositionId: composition.id,
- });
- },
- quickSwitcherLabel: 'Rename composition...',
- subMenu: null,
- type: 'item' as const,
- value: 'rename',
- disabled: !composition || readOnlyStudio,
- }
- : null,
- includeCompositionManagementItems
- ? {
- id: 'duplicate',
- keyHint: null,
- label: `Duplicate...`,
- leftItem: null,
- onClick: () => {
- if (!composition) {
- return;
- }
-
- closeMenu();
- setSelectedModal({
- type: 'duplicate-comp',
- compositionId: composition.id,
- compositionType:
- composition.durationInFrames === 1 ? 'still' : 'composition',
- });
- },
- quickSwitcherLabel: 'Duplicate composition...',
- subMenu: null,
- type: 'item' as const,
- value: 'duplicate',
- disabled: !composition || readOnlyStudio,
- }
- : null,
- includeCompositionManagementItems
- ? {
- id: 'delete',
- keyHint: null,
- label: `Delete...`,
- leftItem: null,
- onClick: () => {
- if (!composition) {
- return;
- }
-
- closeMenu();
- setSelectedModal({
- type: 'delete-comp',
- compositionId: composition.id,
- });
- },
- quickSwitcherLabel: 'Delete composition...',
- subMenu: null,
- type: 'item' as const,
- value: 'delete',
- disabled: !composition || readOnlyStudio,
- }
- : null,
- hasOpenInItems || includeCompositionManagementItems
- ? {
- type: 'divider' as const,
- id: 'copy-actions-divider',
- }
- : null,
{
id: 'copy-context-for-agents',
keyHint: null,
@@ -512,6 +422,86 @@ export const getCompositionMenuItems = ({
value: 'copy-id',
disabled: !composition,
},
+ includeCompositionManagementItems
+ ? {
+ type: 'divider' as const,
+ id: 'show-in-editor-divider',
+ }
+ : null,
+ includeCompositionManagementItems
+ ? {
+ id: 'rename',
+ keyHint: null,
+ label: `Rename...`,
+ leftItem: null,
+ onClick: () => {
+ if (!composition) {
+ return;
+ }
+
+ closeMenu();
+ setSelectedModal({
+ type: 'rename-comp',
+ compositionId: composition.id,
+ });
+ },
+ quickSwitcherLabel: 'Rename composition...',
+ subMenu: null,
+ type: 'item' as const,
+ value: 'rename',
+ disabled: !composition || readOnlyStudio,
+ }
+ : null,
+ includeCompositionManagementItems
+ ? {
+ id: 'duplicate',
+ keyHint: null,
+ label: `Duplicate...`,
+ leftItem: null,
+ onClick: () => {
+ if (!composition) {
+ return;
+ }
+
+ closeMenu();
+ setSelectedModal({
+ type: 'duplicate-comp',
+ compositionId: composition.id,
+ compositionType:
+ composition.durationInFrames === 1 ? 'still' : 'composition',
+ });
+ },
+ quickSwitcherLabel: 'Duplicate composition...',
+ subMenu: null,
+ type: 'item' as const,
+ value: 'duplicate',
+ disabled: !composition || readOnlyStudio,
+ }
+ : null,
+ includeCompositionManagementItems
+ ? {
+ id: 'delete',
+ keyHint: null,
+ label: `Delete...`,
+ leftItem: null,
+ onClick: () => {
+ if (!composition) {
+ return;
+ }
+
+ closeMenu();
+ setSelectedModal({
+ type: 'delete-comp',
+ compositionId: composition.id,
+ });
+ },
+ quickSwitcherLabel: 'Delete composition...',
+ subMenu: null,
+ type: 'item' as const,
+ value: 'delete',
+ disabled: !composition || readOnlyStudio,
+ }
+ : null,
].filter(NoReactInternals.truthy);
};
diff --git a/packages/studio/src/components/folder-menu-items.ts b/packages/studio/src/components/folder-menu-items.ts
index 6bad1e69a8..872989f89a 100644
--- a/packages/studio/src/components/folder-menu-items.ts
+++ b/packages/studio/src/components/folder-menu-items.ts
@@ -129,12 +129,31 @@ export const getFolderMenuItems = ({
value: 'copy-folder-file-location',
disabled: copyFileLocationDisabled,
},
- editorName || fileLocation
- ? {
- type: 'divider' as const,
- id: 'show-folder-in-editor-divider',
- }
- : null,
+ {
+ id: 'copy-folder-id',
+ keyHint: null,
+ label: `Copy ID`,
+ leftItem: null,
+ onClick: () => {
+ closeMenu();
+ copyText(folderId)
+ .then(() => {
+ showNotification('Copied to clipboard', 1000);
+ })
+ .catch((err) => {
+ showNotification(
+ `Could not copy to clipboard: ${(err as Error).message}`,
+ 1000,
+ );
+ });
+ },
+ quickSwitcherLabel: 'Copy folder ID',
+ subMenu: null,
+ type: 'item' as const,
+ value: 'copy-folder-id',
+ disabled: false,
+ },
+ {type: 'divider' as const, id: 'show-folder-in-editor-divider'},
{
id: 'new-composition-in-folder',
keyHint: null,
@@ -215,33 +234,5 @@ export const getFolderMenuItems = ({
value: 'delete-folder',
disabled: codemodDisabled,
},
- {
- type: 'divider' as const,
- id: 'copy-folder-id-divider',
- },
- {
- id: 'copy-folder-id',
- keyHint: null,
- label: `Copy ID`,
- leftItem: null,
- onClick: () => {
- closeMenu();
- copyText(folderId)
- .then(() => {
- showNotification('Copied to clipboard', 1000);
- })
- .catch((err) => {
- showNotification(
- `Could not copy to clipboard: ${(err as Error).message}`,
- 1000,
- );
- });
- },
- quickSwitcherLabel: 'Copy folder ID',
- subMenu: null,
- type: 'item' as const,
- value: 'copy-folder-id',
- disabled: false,
- },
].filter(NoReactInternals.truthy);
};
diff --git a/packages/studio/src/test/sequence-context-menu-items.test.ts b/packages/studio/src/test/sequence-context-menu-items.test.ts
index 13a5739599..28653edd28 100644
--- a/packages/studio/src/test/sequence-context-menu-items.test.ts
+++ b/packages/studio/src/test/sequence-context-menu-items.test.ts
@@ -193,7 +193,12 @@ test('sequence context menu adds frame copying and normalizes dividers', () => {
documentationLink: 'https://www.remotion.dev/docs/sequence',
type: 'sequence',
} as TSequence,
- sourceActions: [renameSequenceItem],
+ sourceActions: {
+ rename: renameSequenceItem,
+ timing: [],
+ appearance: [],
+ unwrap: null,
+ },
});
expectNoExtraDividers(items);
@@ -288,6 +293,7 @@ test('sequence context menu shares alternate apps without repeating defaults', (
source: '/project/src/Video.tsx',
},
selectAsset: noop,
+ sourceActions: null,
sequence: {displayName: 'Intro card'} as TSequence,
});
@@ -381,6 +387,7 @@ test('Interactive.Svg context menu can copy the rendered SVG', () => {
openInEditor: noop,
originalLocation: null,
selectAsset: noop,
+ sourceActions: null,
sequence: {
controls: {
componentIdentity: 'dev.remotion.remotion.Interactive.Svg',
@@ -426,6 +433,7 @@ test('programmatically duplicated sequence menus apply actions to all instances'
openInEditor: noop,
originalLocation: null,
selectAsset: noop,
+ sourceActions: null,
sequence: {} as TSequence,
});
@@ -461,6 +469,7 @@ test('read-only sequence menus only contain non-mutating actions', () => {
openInEditor: noop,
originalLocation: null,
selectAsset: noop,
+ sourceActions: null,
sequence: {
controls: {
componentIdentity: 'dev.remotion.remotion.Interactive.Svg',
@@ -518,6 +527,7 @@ test('read-only sequence menus open source locations on GitHub', () => {
source: '/project/src/Video.tsx',
},
selectAsset: noop,
+ sourceActions: null,
sequence: {} as TSequence,
});