Skip to content

🎥 Make videos programmatically with React

`@remotion/studio`: Unify Open in menus across canvas and timeline (#10217)

Jonny Burger632b09ffd267
diff --git a/packages/example/e2e/studio.test.mts b/packages/example/e2e/studio.test.mts
index ce81c5e4fc..304c593020 100644
--- a/packages/example/e2e/studio.test.mts
+++ b/packages/example/e2e/studio.test.mts
@@ -164,8 +164,12 @@ test.describe('visual mode', () => {
data: {
defaultEditor: null,
installedEditors: [
- {id: 'vscode', name: 'VS Code'},
- {id: 'cursor', name: 'Cursor'},
+ {id: 'vscode', name: 'Code', nameWithType: 'Code'},
+ {
+ id: 'cursor',
+ name: 'Cursor',
+ nameWithType: 'Cursor Editor',
+ },
],
},
},
@@ -179,13 +183,17 @@ test.describe('visual mode', () => {
data: {
defaultCodingAgent: null,
installedCodingAgents: [
- {id: 'codex', iconDataUrl: null, name: 'Codex'},
+ {
+ id: 'codex',
+ iconDataUrl: null,
+ name: 'Codex',
+ nameWithType: 'Codex',
+ },
],
},
},
});
});
-
try {
await page.goto(`${STUDIO_URL}/schema-test`);
await page.locator('[data-sidebar-toggle="right"]').click();
@@ -211,7 +219,7 @@ test.describe('visual mode', () => {
const dialog = page.getByRole('dialog');
await expect(
dialog.getByTitle('Default editor', {exact: true}),
- ).toContainText('Cursor');
+ ).toHaveText('Cursor');
await expect(
dialog.getByTitle('Default coding agent', {exact: true}),
).toContainText('Codex');
@@ -296,7 +304,174 @@ test.describe('visual mode', () => {
).toBeVisible();
});
- test('should pass the copied inspector prompt to editable coding agents', async ({
+ test('should use standalone and contextual app names in portaled context menus', async ({
+ context,
+ page,
+ }) => {
+ const configFile = path.join(exampleDir, 'remotion.config.ts');
+ const configBeforeTest = fs.readFileSync(configFile, 'utf8');
+ await context.grantPermissions(['clipboard-read', 'clipboard-write'], {
+ origin: STUDIO_URL,
+ });
+ await page.route('**/api/default-editor-info', async (route) => {
+ await route.fulfill({
+ json: {
+ success: true,
+ data: {
+ defaultEditor: 'cursor',
+ installedEditors: [
+ {
+ id: 'cursor',
+ name: 'Cursor',
+ nameWithType: 'Cursor Editor',
+ },
+ {id: 'vscode', name: 'Code', nameWithType: 'Code'},
+ ],
+ },
+ },
+ });
+ });
+ await page.route('**/api/default-coding-agent-info', async (route) => {
+ await route.fulfill({
+ json: {
+ success: true,
+ data: {
+ defaultCodingAgent: 'cursor',
+ installedCodingAgents: [
+ {
+ id: 'cursor',
+ iconDataUrl: null,
+ name: 'Cursor',
+ nameWithType: 'Cursor Agent',
+ },
+ {
+ id: 'codex',
+ iconDataUrl: null,
+ name: 'Codex',
+ nameWithType: 'Codex',
+ },
+ ],
+ },
+ },
+ });
+ });
+ const launchRequests: Array<{
+ readonly codingAgentId: string;
+ readonly prompt: string | null;
+ }> = [];
+ await page.route('**/api/open-in-coding-agent', async (route) => {
+ launchRequests.push(route.request().postDataJSON());
+ await route.fulfill({
+ json: {success: true, data: {success: true}},
+ });
+ });
+
+ try {
+ await page.goto(`${STUDIO_URL}/AnimatedBarChart`);
+ const firstGridline = page.getByText('0% gridline', {exact: true});
+ await expect(firstGridline).toBeVisible({timeout: 15_000});
+
+ fs.writeFileSync(
+ configFile,
+ `${configBeforeTest}\nConfig.setDefaultEditor('cursor');\nConfig.setDefaultCodingAgent('cursor');\n`,
+ );
+ await expect
+ .poll(() =>
+ page.evaluate(() => window.remotion_studioConfig?.defaultCodingAgent),
+ )
+ .toBe('cursor');
+ await page.evaluate(() => {
+ window.remotion_editorName = 'Cursor Editor';
+ });
+
+ const timelineGridline = page.locator(
+ '[data-timeline-marquee-item][title="0% gridline"]',
+ );
+ await timelineGridline.click({button: 'right'});
+ await expect(
+ page.getByText('Open in Cursor Editor', {exact: true}),
+ ).toBeVisible();
+ await expect(
+ page.getByText('Open in Cursor Agent', {exact: true}),
+ ).toBeVisible();
+ await expect(
+ page.getByRole('button', {name: 'Open component docs', exact: true}),
+ ).toHaveCount(0);
+ await page
+ .getByRole('button', {name: 'Open in Cursor Agent', exact: true})
+ .click();
+ await expect.poll(() => launchRequests.length).toBe(1);
+ expect(launchRequests[0]?.codingAgentId).toBe('cursor');
+ expect(launchRequests[0]?.prompt).toMatch(
+ /^0% gridline in src\/BarChart\.tsx:\d+$/,
+ );
+ const contextForAgents = launchRequests[0]?.prompt;
+ await timelineGridline.click({button: 'right'});
+ await page
+ .getByRole('button', {name: 'Copy context for agents', exact: true})
+ .click();
+ await expect
+ .poll(() => page.evaluate(() => navigator.clipboard.readText()))
+ .toBe(contextForAgents);
+
+ fs.writeFileSync(
+ configFile,
+ `${configBeforeTest}\nConfig.setDefaultEditor('vscode');\nConfig.setDefaultCodingAgent('codex');\n`,
+ );
+ await expect
+ .poll(() =>
+ page.evaluate(() => window.remotion_studioConfig?.defaultCodingAgent),
+ )
+ .toBe('codex');
+ await page.evaluate(() => {
+ window.remotion_editorName = 'Code';
+ });
+
+ await timelineGridline.click({button: 'right'});
+ await expect(
+ page.getByText('Open in Codex', {exact: true}),
+ ).toBeVisible();
+ await page.getByRole('button', {name: 'Open in...', exact: true}).click();
+ await expect(page.getByText('Editors', {exact: true})).toBeVisible();
+ await expect(page.getByText('Agents', {exact: true})).toBeVisible();
+ await expect(
+ page.getByRole('button', {name: 'Cursor', exact: true}),
+ ).toHaveCount(2);
+ await page
+ .getByRole('button', {name: 'Change default apps...', exact: true})
+ .click();
+
+ const settings = page.getByRole('dialog');
+ await expect(settings.getByText('Apps', {exact: true})).toBeVisible();
+ } finally {
+ fs.writeFileSync(configFile, configBeforeTest);
+ }
+ });
+
+ test('should dismiss an overflow menu tree with one outside click', async ({
+ page,
+ }) => {
+ await page.setViewportSize({width: 800, height: 904});
+ await page.goto(`${STUDIO_URL}/AnimatedBarChart`);
+ await expect(page.getByText('0% gridline', {exact: true})).toBeVisible({
+ timeout: 15_000,
+ });
+
+ await page.getByRole('button', {name: 'More actions'}).click();
+ await page
+ .getByRole('button', {name: 'Playback Rate', exact: true})
+ .click();
+ await expect(
+ page.getByRole('button', {name: '1x', exact: true}),
+ ).toBeVisible();
+
+ await page.mouse.click(10, 100);
+ await expect(
+ page.getByRole('button', {name: 'Playback Rate', exact: true}),
+ ).toBeHidden();
+ });
+
+ test('should pass the copied inspector context to editable coding agents', async ({
context,
page,
}) => {
@@ -310,11 +485,17 @@ test.describe('visual mode', () => {
data: {
defaultCodingAgent: null,
installedCodingAgents: [
- {id: 'codex', iconDataUrl: null, name: 'Codex'},
+ {
+ id: 'codex',
+ iconDataUrl: null,
+ name: 'Codex',
+ nameWithType: 'Codex',
+ },
{
id: 'copilot',
iconDataUrl: null,
name: 'GitHub Copilot',
+ nameWithType: 'GitHub Copilot',
},
],
},
@@ -339,12 +520,12 @@ test.describe('visual mode', () => {
await sourceLocation.hover();
await sourceLocation
- .getByRole('button', {name: 'Copy location for agents'})
+ .getByRole('button', {name: 'Copy context for agents'})
.click();
- const copiedPrompt = await page.evaluate(() =>
+ const copiedContext = await page.evaluate(() =>
navigator.clipboard.readText(),
);
- expect(copiedPrompt.length).toBeGreaterThan(0);
+ expect(copiedContext.length).toBeGreaterThan(0);
const openInAnotherApp = sourceLocation.getByRole('button', {
name: 'Open in another app',
@@ -354,7 +535,7 @@ test.describe('visual mode', () => {
await expect.poll(() => launchRequests.length).toBe(1);
expect(launchRequests[0]).toEqual({
codingAgentId: 'codex',
- prompt: copiedPrompt,
+ prompt: copiedContext,
});
await openInAnotherApp.click();
diff --git a/packages/studio-server/src/helpers/coding-agent-registry.ts b/packages/studio-server/src/helpers/coding-agent-registry.ts
index 95afdf6102..12bd7741f9 100644
--- a/packages/studio-server/src/helpers/coding-agent-registry.ts
+++ b/packages/studio-server/src/helpers/coding-agent-registry.ts
@@ -11,6 +11,7 @@ const execFilePromise = promisify(execFile);
export type InstalledCodingAgent = {
id: DefaultCodingAgent;
name: string;
+ nameWithType: string;
applicationPath: string;
iconDataUrl: string | null;
platform: SupportedCodingAgentPlatform;
@@ -47,6 +48,7 @@ type ExecutableCodingAgentVariant = {
type CodingAgentDefinition = {
name: string;
+ nameWithType: string;
darwin: DarwinCodingAgentVariant;
linux: readonly ExecutableCodingAgentVariant[];
win32: readonly ExecutableCodingAgentVariant[];
@@ -109,6 +111,7 @@ const getWindowsEnvironmentPaths = (
const codingAgentDefinitions = {
codex: {
name: 'Codex',
+ nameWithType: 'Codex',
darwin: {
bundleIdentifiers: ['com.openai.codex'],
applicationNames: ['ChatGPT.app'],
@@ -154,6 +157,7 @@ const codingAgentDefinitions = {
},
cursor: {
name: 'Cursor',
+ nameWithType: 'Cursor Agent',
darwin: {
bundleIdentifiers: ['com.todesktop.230313mzl4w4u92'],
applicationNames: ['Cursor.app'],
@@ -189,6 +193,7 @@ const codingAgentDefinitions = {
},
copilot: {
name: 'GitHub Copilot',
+ nameWithType: 'GitHub Copilot',
darwin: {
bundleIdentifiers: ['com.github.githubapp'],
applicationNames: ['GitHub Copilot.app'],
@@ -210,6 +215,7 @@ const codingAgentDefinitions = {
},
'claude-code': {
name: 'Claude Code',
+ nameWithType: 'Claude Code',
darwin: {
bundleIdentifiers: ['com.anthropic.claudefordesktop'],
applicationNames: ['Claude.app'],
@@ -385,6 +391,7 @@ export const discoverAvailableCodingAgents = async (
id,
launchMode: 'direct',
name: definition.name,
+ nameWithType: definition.nameWithType,
platform,
terminal: null,
});
@@ -411,6 +418,7 @@ export const discoverAvailableCodingAgents = async (
id,
launchMode: variant.launchMode,
name: definition.name,
+ nameWithType: definition.nameWithType,
platform,
terminal: variant.launchMode === 'terminal' ? terminal : null,
});
diff --git a/packages/studio-server/src/helpers/editor-registry.ts b/packages/studio-server/src/helpers/editor-registry.ts
index e055cf2104..babc963168 100644
--- a/packages/studio-server/src/helpers/editor-registry.ts
+++ b/packages/studio-server/src/helpers/editor-registry.ts
@@ -11,12 +11,14 @@ const execFilePromise = promisify(execFile);
export type InstalledEditor = {
id: BuiltInEditor;
name: string;
+ nameWithType: string;
process: string;
command: string;
};
type DarwinEditorVariant = {
name: string;
+ nameWithType: string;
bundleIdentifiers: readonly string[];
applicationNames: readonly string[];
executable: string;
@@ -25,6 +27,7 @@ type DarwinEditorVariant = {
type ExecutableEditorVariant = {
name: string;
+ nameWithType: string;
paths: (context: EditorDiscoveryContext) => readonly string[];
commands: readonly string[];
};
@@ -73,7 +76,8 @@ const editorDefinitions = {
vscode: {
darwin: [
{
- name: 'VS Code',
+ name: 'Code',
+ nameWithType: 'Code',
bundleIdentifiers: ['com.microsoft.VSCode'],
applicationNames: ['Visual Studio Code.app'],
executable: 'Contents/Resources/app/bin/code',
@@ -81,6 +85,7 @@ const editorDefinitions = {
},
{
name: 'VS Code Insiders',
+ nameWithType: 'VS Code Insiders',
bundleIdentifiers: ['com.microsoft.VSCodeInsiders'],
applicationNames: ['Visual Studio Code - Insiders.app'],
executable: 'Contents/Resources/app/bin/code-insiders',
@@ -89,7 +94,8 @@ const editorDefinitions = {
],
linux: [
{
- name: 'VS Code',
+ name: 'Code',
+ nameWithType: 'Code',
paths: () => [
'/usr/share/code/bin/code',
'/snap/bin/code',
@@ -100,6 +106,7 @@ const editorDefinitions = {
},
{
name: 'VS Code Insiders',
+ nameWithType: 'VS Code Insiders',
paths: () => [
'/snap/bin/code-insiders',
'/usr/bin/code-insiders',
@@ -110,7 +117,8 @@ const editorDefinitions = {
],
win32: [
{
- name: 'VS Code',
+ name: 'Code',
+ nameWithType: 'Code',
paths: (context) =>
getWindowsEnvironmentPaths(context, [
'Microsoft VS Code',
@@ -120,6 +128,7 @@ const editorDefinitions = {
},
{
name: 'VS Code Insiders',
+ nameWithType: 'VS Code Insiders',
paths: (context) =>
getWindowsEnvironmentPaths(context, [
'Microsoft VS Code Insiders',
@@ -133,6 +142,7 @@ const editorDefinitions = {
darwin: [
{
name: 'Cursor',
+ nameWithType: 'Cursor Editor',
bundleIdentifiers: ['com.todesktop.230313mzl4w4u92'],
applicationNames: ['Cursor.app'],
executable: 'Contents/Resources/app/bin/cursor',
@@ -142,6 +152,7 @@ const editorDefinitions = {
linux: [
{
name: 'Cursor',
+ nameWithType: 'Cursor Editor',
paths: (context) => [
'/usr/bin/cursor',
'/usr/local/bin/cursor',
@@ -153,6 +164,7 @@ const editorDefinitions = {
win32: [
{
name: 'Cursor',
+ nameWithType: 'Cursor Editor',
paths: (context) =>
getWindowsEnvironmentPaths(context, ['cursor', 'Cursor.exe']),
commands: ['Cursor.exe', 'cursor.cmd'],
@@ -163,6 +175,7 @@ const editorDefinitions = {
darwin: [
{
name: 'Windsurf',
+ nameWithType: 'Windsurf',
bundleIdentifiers: ['com.exafunction.windsurf'],
applicationNames: ['Windsurf.app'],
executable: 'Contents/Resources/app/bin/windsurf',
@@ -172,6 +185,7 @@ const editorDefinitions = {
linux: [
{
name: 'Windsurf',
+ nameWithType: 'Windsurf',
paths: (context) => [
'/usr/bin/windsurf',
'/usr/local/bin/windsurf',
@@ -183,6 +197,7 @@ const editorDefinitions = {
win32: [
{
name: 'Windsurf',
+ nameWithType: 'Windsurf',
paths: (context) =>
getWindowsEnvironmentPaths(context, ['Windsurf', 'Windsurf.exe']),
commands: ['Windsurf.exe', 'windsurf.cmd'],
@@ -193,6 +208,7 @@ const editorDefinitions = {
darwin: [
{
name: 'Zed',
+ nameWithType: 'Zed',
bundleIdentifiers: ['dev.zed.Zed'],
applicationNames: ['Zed.app'],
executable: 'Contents/MacOS/cli',
@@ -200,6 +216,7 @@ const editorDefinitions = {
},
{
name: 'Zed Preview',
+ nameWithType: 'Zed Preview',
bundleIdentifiers: ['dev.zed.Zed-Preview'],
applicationNames: ['Zed Preview.app'],
executable: 'Contents/MacOS/cli',
@@ -209,6 +226,7 @@ const editorDefinitions = {
linux: [
{
name: 'Zed',
+ nameWithType: 'Zed',
paths: (context) => [
'/usr/bin/zedit',
'/usr/bin/zeditor',
@@ -222,6 +240,7 @@ const editorDefinitions = {
win32: [
{
name: 'Zed',
+ nameWithType: 'Zed',
paths: (context) =>
getWindowsEnvironmentPaths(context, ['Zed', 'Zed.exe']),
commands: ['Zed.exe'],
@@ -232,6 +251,7 @@ const editorDefinitions = {
darwin: [
{
name: 'VSCodium',
+ nameWithType: 'VSCodium',
bundleIdentifiers: ['com.vscodium', 'com.visualstudio.code.oss'],
applicationNames: ['VSCodium.app'],
executable: 'Contents/Resources/app/bin/codium',
@@ -241,6 +261,7 @@ const editorDefinitions = {
linux: [
{
name: 'VSCodium',
+ nameWithType: 'VSCodium',
paths: (context) => [
'/usr/bin/codium',
'/usr/share/vscodium-bin/bin/codium',
@@ -257,6 +278,7 @@ const editorDefinitions = {
win32: [
{
name: 'VSCodium',
+ nameWithType: 'VSCodium',
paths: (context) =>
getWindowsEnvironmentPaths(context, ['VSCodium', 'VSCodium.exe']),
commands: ['VSCodium.exe', 'codium.cmd'],
@@ -267,6 +289,7 @@ const editorDefinitions = {
darwin: [
{
name: 'WebStorm',
+ nameWithType: 'WebStorm',
bundleIdentifiers: ['com.jetbrains.WebStorm'],
applicationNames: ['WebStorm.app'],
executable: 'Contents/MacOS/webstorm',
@@ -276,6 +299,7 @@ const editorDefinitions = {
linux: [
{
name: 'WebStorm',
+ nameWithType: 'WebStorm',
paths: (context) => [
'/snap/bin/webstorm',
path.posix.join(
@@ -289,6 +313,7 @@ const editorDefinitions = {
win32: [
{
name: 'WebStorm',
+ nameWithType: 'WebStorm',
paths: (context) => {
const localAppData = context.env.LOCALAPPDATA;
return localAppData
@@ -308,6 +333,7 @@ const editorDefinitions = {
darwin: [
{
name: 'Sublime Text',
+ nameWithType: 'Sublime Text',
bundleIdentifiers: [
'com.sublimetext.4',
'com.sublimetext.3',
@@ -325,6 +351,7 @@ const editorDefinitions = {
linux: [
{
name: 'Sublime Text',
+ nameWithType: 'Sublime Text',
paths: () => ['/usr/bin/subl', '/snap/bin/subl'],
commands: ['subl'],
},
@@ -332,6 +359,7 @@ const editorDefinitions = {
win32: [
{
name: 'Sublime Text',
+ nameWithType: 'Sublime Text',
paths: (context) => [
...getWindowsEnvironmentPaths(context, [
'Sublime Text',
@@ -510,6 +538,7 @@ const findDarwinEditor = async ({
return {
id,
name: variant.name,
+ nameWithType: variant.nameWithType,
process: executablePath,
command: variant.command,
};
@@ -568,6 +597,7 @@ const findExecutableEditor = ({
return {
id,
name: variants[0].name,
+ nameWithType: variants[0].nameWithType,
process: executablePath,
command: executablePath,
};
@@ -580,6 +610,7 @@ const findExecutableEditor = ({
return {
id,
name: variant.name,
+ nameWithType: variant.nameWithType,
process: executablePath,
command: executablePath,
};
diff --git a/packages/studio-server/src/helpers/open-in-editor.ts b/packages/studio-server/src/helpers/open-in-editor.ts
index 07a2f2c4c8..61f7f64c63 100644
--- a/packages/studio-server/src/helpers/open-in-editor.ts
+++ b/packages/studio-server/src/helpers/open-in-editor.ts
@@ -69,12 +69,12 @@ const displayNameForEditor: Record<string, string> = {
'/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl':
'Sublime Text',
'/Applications/WebStorm.app/Contents/MacOS/webstorm': 'WebStorm',
- '/Applications/Cursor.app/Contents/MacOS/Cursor': 'Cursor',
+ '/Applications/Cursor.app/Contents/MacOS/Cursor': 'Cursor Editor',
'/Applications/Windsurf.app/Contents/MacOS/Windsurf': 'Windsurf',
'Brackets.exe': 'Brackets',
'Code - Insiders.exe': 'VS Code Insiders',
- 'Code.exe': 'VS Code',
- 'Cursor.exe': 'Cursor',
+ 'Code.exe': 'Code',
+ 'Cursor.exe': 'Cursor Editor',
'Windsurf.exe': 'Windsurf',
'Zed.exe': 'Zed',
'VSCodium.exe': 'VS Codium',
@@ -100,8 +100,8 @@ const displayNameForEditor: Record<string, string> = {
'webstorm64.exe': 'WebStorm',
atom: 'Atom',
brackets: 'Brackets',
- code: 'VS Code',
- cursor: 'Cursor',
+ code: 'Code',
+ cursor: 'Cursor Editor',
windsurf: 'Windsurf',
zed: 'Zed',
zedit: 'Zed',
diff --git a/packages/studio-server/src/helpers/resolve-editor.ts b/packages/studio-server/src/helpers/resolve-editor.ts
index a9897f3c6d..88cfbb80a3 100644
--- a/packages/studio-server/src/helpers/resolve-editor.ts
+++ b/packages/studio-server/src/helpers/resolve-editor.ts
@@ -19,11 +19,13 @@ export type ResolvedEditor =
type: 'built-in';
id: BuiltInEditor | null;
name: string;
+ nameWithType: string;
})
| (ResolvedCustomEditorExecutable & {
type: 'custom';
id: 'custom';
name: string;
+ nameWithType: string;
editor: CustomEditor;
});
@@ -89,6 +91,7 @@ export const resolveEditor = async (
type: 'custom',
id: 'custom',
name: defaultEditor.name,
+ nameWithType: defaultEditor.name,
editor: defaultEditor,
};
}
@@ -110,6 +113,7 @@ export const resolveEditor = async (
type: 'custom',
id: 'custom',
name: defaultEditor.name,
+ nameWithType: defaultEditor.name,
editor: defaultEditor,
};
}
@@ -150,5 +154,7 @@ export const resolveEditor = async (
type: 'built-in',
id: null,
name: getDisplayNameForEditor(legacyEditor.command) ?? legacyEditor.command,
+ nameWithType:
+ getDisplayNameForEditor(legacyEditor.command) ?? legacyEditor.command,
};
};
diff --git a/packages/studio-server/src/preview-server/routes/default-coding-agent.ts b/packages/studio-server/src/preview-server/routes/default-coding-agent.ts
index 2ce3268326..5f2376f6a5 100644
--- a/packages/studio-server/src/preview-server/routes/default-coding-agent.ts
+++ b/packages/studio-server/src/preview-server/routes/default-coding-agent.ts
@@ -18,10 +18,11 @@ export const getDefaultCodingAgentInfoHandler: ApiHandler<
return {
defaultCodingAgent: getDefaultCodingAgent(),
installedCodingAgents: installedCodingAgents.map(
- ({iconDataUrl, id, name}) => ({
+ ({iconDataUrl, id, name, nameWithType}) => ({
iconDataUrl,
id,
name,
+ nameWithType,
}),
),
};
diff --git a/packages/studio-server/src/preview-server/routes/default-editor.ts b/packages/studio-server/src/preview-server/routes/default-editor.ts
index f62cca4163..21e5b04ce1 100644
--- a/packages/studio-server/src/preview-server/routes/default-editor.ts
+++ b/packages/studio-server/src/preview-server/routes/default-editor.ts
@@ -19,9 +19,19 @@ export const getDefaultEditorInfoHandler: ApiHandler<
defaultEditor:
typeof configuredEditor === 'object' ? 'custom' : configuredEditor,
installedEditors: [
- ...installedEditors.map(({id, name}) => ({id, name})),
+ ...installedEditors.map(({id, name, nameWithType}) => ({
+ id,
+ name,
+ nameWithType,
+ })),
...(customEditor
- ? [{id: 'custom' as const, name: customEditor.name}]
+ ? [
+ {
+ id: 'custom' as const,
+ name: customEditor.name,
+ nameWithType: customEditor.name,
+ },
+ ]
: []),
],
};
diff --git a/packages/studio-server/src/preview-server/routes/open-in-editor.ts b/packages/studio-server/src/preview-server/routes/open-in-editor.ts
index 11f459e825..c38399520c 100644
--- a/packages/studio-server/src/preview-server/routes/open-in-editor.ts
+++ b/packages/studio-server/src/preview-server/routes/open-in-editor.ts
@@ -26,7 +26,7 @@ export const getEditorName = async ({
logLevel,
preferredEditor: null,
});
- return editor?.name ?? null;
+ return editor?.nameWithType ?? null;
};
export const openInEditorHandler: ApiHandler<
diff --git a/packages/studio-server/src/test/coding-agent-registry.test.ts b/packages/studio-server/src/test/coding-agent-registry.test.ts
index 40e922507f..d32906e003 100644
--- a/packages/studio-server/src/test/coding-agent-registry.test.ts
+++ b/packages/studio-server/src/test/coding-agent-registry.test.ts
@@ -54,6 +54,7 @@ test('discovers supported macOS coding agents without launching them', async ()
id: 'codex',
launchMode: 'direct',
name: 'Codex',
+ nameWithType: 'Codex',
platform: 'darwin',
terminal: null,
},
@@ -63,6 +64,7 @@ test('discovers supported macOS coding agents without launching them', async ()
id: 'claude-code',
launchMode: 'direct',
name: 'Claude Code',
+ nameWithType: 'Claude Code',
platform: 'darwin',
terminal: null,
},
diff --git a/packages/studio-server/src/test/default-editor-route.test.ts b/packages/studio-server/src/test/default-editor-route.test.ts
index 72b6ce6b3f..a3286fdb5f 100644
--- a/packages/studio-server/src/test/default-editor-route.test.ts
+++ b/packages/studio-server/src/test/default-editor-route.test.ts
@@ -30,6 +30,7 @@ test('exposes only an opaque ID and name for a configured custom editor', async
expect(response.installedEditors).toContainEqual({
id: 'custom',
name: 'Acme Editor',
+ nameWithType: 'Acme Editor',
});
expect(JSON.stringify(response)).not.toContain('/private/acme/editor');
expect(JSON.stringify(response)).not.toContain('%TARGET_PATH%');
diff --git a/packages/studio-server/src/test/editor-registry.test.ts b/packages/studio-server/src/test/editor-registry.test.ts
index 44c8448d48..1c364f8548 100644
--- a/packages/studio-server/src/test/editor-registry.test.ts
+++ b/packages/studio-server/src/test/editor-registry.test.ts
@@ -59,6 +59,7 @@ test('discovers installed macOS editors by bundle ID without running them', asyn
command: 'cursor',
id: 'cursor',
name: 'Cursor',
+ nameWithType: 'Cursor Editor',
process: cursorExecutable,
},
]);
@@ -113,6 +114,7 @@ test('uses the configured installed editor instead of legacy detection', async (
command: '/usr/bin/cursor',
id: 'cursor',
name: 'Cursor',
+ nameWithType: 'Cursor Editor',
process: '/usr/bin/cursor',
};
let legacyDetectionCalls = 0;
@@ -136,13 +138,15 @@ test('uses the editor selected by the picker without changing the default', asyn
const vscode: InstalledEditor = {
command: '/usr/bin/code',
id: 'vscode',
- name: 'VS Code',
+ name: 'Code',
+ nameWithType: 'Code',
process: '/usr/bin/code',
};
const cursor: InstalledEditor = {
command: '/usr/bin/cursor',
id: 'cursor',
name: 'Cursor',
+ nameWithType: 'Cursor Editor',
process: '/usr/bin/cursor',
};
let legacyDetectionCalls = 0;
@@ -215,6 +219,7 @@ test('resolves a custom editor without exposing it to built-in discovery', async
type: 'custom',
id: 'custom',
name: 'Acme Editor',
+ nameWithType: 'Acme Editor',
editor: customEditor,
executable: '/opt/acme/editor',
spawnAsMacApplication: false,
@@ -243,7 +248,7 @@ test('warns and falls back when a custom editor executable is unavailable', asyn
},
);
- expect(resolved?.name).toBe('VS Code');
+ expect(resolved?.name).toBe('Code');
expect(warnings).toEqual([
'The executable for custom editor Acme Editor (/missing/acme) was not found or is not executable. Falling back to automatic editor detection.',
]);
@@ -272,7 +277,8 @@ test('warns once and falls back when the configured editor is unavailable', asyn
expect(first).toEqual({
command: 'code',
id: null,
- name: 'VS Code',
+ name: 'Code',
+ nameWithType: 'Code',
process: 'code',
type: 'built-in',
});
diff --git a/packages/studio-server/src/test/open-in-coding-agent.test.ts b/packages/studio-server/src/test/open-in-coding-agent.test.ts
index df1765a49c..434a8a666e 100644
--- a/packages/studio-server/src/test/open-in-coding-agent.test.ts
+++ b/packages/studio-server/src/test/open-in-coding-agent.test.ts
@@ -26,6 +26,7 @@ test('constructs macOS coding agent launch commands', () => {
id: 'codex',
launchMode: 'direct',
name: 'Codex',
+ nameWithType: 'Codex',
platform: 'darwin',
terminal: null,
},
@@ -45,6 +46,7 @@ test('constructs macOS coding agent launch commands', () => {
id: 'cursor',
launchMode: 'direct',
name: 'Cursor',
+ nameWithType: 'Cursor Agent',
platform: 'darwin',
terminal: null,
},
@@ -63,6 +65,7 @@ test('constructs macOS coding agent launch commands', () => {
id: 'copilot' as const,
launchMode: 'direct' as const,
name: 'GitHub Copilot',
+ nameWithType: 'GitHub Copilot',
platform: 'darwin' as const,
terminal: null,
},
@@ -72,6 +75,7 @@ test('constructs macOS coding agent launch commands', () => {
id: 'claude-code' as const,
launchMode: 'direct' as const,
name: 'Claude Code',
+ nameWithType: 'Claude Code',
platform: 'darwin' as const,
terminal: null,
},
@@ -98,6 +102,7 @@ test('constructs Linux coding agent launch commands', () => {
id: 'codex',
launchMode: 'terminal',
name: 'Codex',
+ nameWithType: 'Codex',
platform: 'linux',
terminal: {
id: 'gnome-terminal',
@@ -124,6 +129,7 @@ test('constructs Linux coding agent launch commands', () => {
id: 'cursor',
launchMode: 'direct',
name: 'Cursor',
+ nameWithType: 'Cursor Agent',
platform: 'linux',
terminal: null,
},
@@ -145,6 +151,7 @@ test('constructs Windows coding agent launch commands', () => {
id: 'copilot',
launchMode: 'terminal',
name: 'GitHub Copilot',
+ nameWithType: 'GitHub Copilot',
platform: 'win32',
terminal: {
id: 'cmd',
@@ -183,6 +190,7 @@ test('prefills editable macOS coding agents without submitting to Copilot', () =
id: 'codex',
launchMode: 'direct',
name: 'Codex',
+ nameWithType: 'Codex',
platform: 'darwin',
terminal: null,
},
@@ -208,6 +216,7 @@ test('prefills editable macOS coding agents without submitting to Copilot', () =
id: 'cursor',
launchMode: 'direct',
name: 'Cursor',
+ nameWithType: 'Cursor Agent',
platform: 'darwin',
terminal: null,
},
@@ -239,6 +248,7 @@ test('prefills editable macOS coding agents without submitting to Copilot', () =
id: 'claude-code',
launchMode: 'direct',
name: 'Claude Code',
+ nameWithType: 'Claude Code',
platform: 'darwin',
terminal: null,
},
@@ -264,6 +274,7 @@ test('prefills editable macOS coding agents without submitting to Copilot', () =
id: 'copilot',
launchMode: 'direct',
name: 'GitHub Copilot',
+ nameWithType: 'GitHub Copilot',
platform: 'darwin',
terminal: null,
},
@@ -309,6 +320,7 @@ test.skipIf(process.platform === 'win32')(
id: 'codex',
launchMode: 'direct',
name: 'Codex',
+ nameWithType: 'Codex',
platform: 'darwin',
terminal: null,
},
@@ -361,6 +373,7 @@ test.skipIf(process.platform === 'win32')(
id: 'codex',
launchMode: 'terminal',
name: 'Codex',
+ nameWithType: 'Codex',
platform: 'linux',
terminal: {id: 'gnome-terminal', path: terminalPath},
},
diff --git a/packages/studio-shared/src/api-requests.ts b/packages/studio-shared/src/api-requests.ts
index a4b7311a39..f2ab4d62bc 100644
--- a/packages/studio-shared/src/api-requests.ts
+++ b/packages/studio-shared/src/api-requests.ts
@@ -1018,7 +1018,11 @@ export type GetDefaultEditorInfoRequest = {};
export type EditorPickerId = BuiltInEditor | 'custom';
export type GetDefaultEditorInfoResponse = {
defaultEditor: EditorPickerId | null;
- installedEditors: {id: EditorPickerId; name: string}[];
+ installedEditors: {
+ id: EditorPickerId;
+ name: string;
+ nameWithType: string;
+ }[];
};
export type GetDefaultCodingAgentInfoRequest = {};
@@ -1027,6 +1031,7 @@ export type GetDefaultCodingAgentInfoResponse = {
installedCodingAgents: {
id: DefaultCodingAgent;
name: string;
+ nameWithType: string;
iconDataUrl: string | null;
}[];
};
diff --git a/packages/studio/src/components/ContextMenu.tsx b/packages/studio/src/components/ContextMenu.tsx
index 0b6ff72a5e..60a703e3da 100644
--- a/packages/studio/src/components/ContextMenu.tsx
+++ b/packages/studio/src/components/ContextMenu.tsx
@@ -4,6 +4,11 @@ import ReactDOM from 'react-dom';
import {useMobileLayout} from '../helpers/mobile-layout';
import {noop} from '../helpers/noop';
import {HigherZIndex, useZIndex} from '../state/z-index';
+import {
+ getNextMenuTreeId,
+ isNodeInMenuTree,
+ MenuTreeContext,
+} from './Menu/menu-tree-context';
import {getPortal} from './Menu/portals';
import {
MAX_MENU_WIDTH,
@@ -83,12 +88,12 @@ const notifyContextMenuOpened = (id: number) => {
};
const ContextMenuPortal: React.FC<{
+ readonly menuTreeId: number;
readonly sizeSource: ContextMenuSizeSource;
readonly currentZIndex: number;
readonly onHide: () => void;
readonly opened: OpenedState;
-}> = ({sizeSource, currentZIndex, onHide, opened}) => {
- const menuRef = useRef<HTMLDivElement>(null);
+}> = ({menuTreeId, sizeSource, currentZIndex, onHide, opened}) => {
const size = PlayerInternals.useElementSize(sizeSource, {
triggerOnWindowResize: true,
shouldApplyCssTransforms: true,
@@ -172,7 +177,8 @@ const ContextMenuPortal: React.FC<{
return;
}
- if (menuRef.current?.contains(event.target as Node)) {
+ const target = event.target as Node;
+ if (isNodeInMenuTree(target, menuTreeId)) {
return;
}
@@ -191,7 +197,7 @@ const ContextMenuPortal: React.FC<{
true,
);
};
- }, [onHide]);
+ }, [menuTreeId, onHide]);
// Prevent deselection of a selected item
const onMenuPointerDown = useCallback(
@@ -214,20 +220,22 @@ const ContextMenuPortal: React.FC<{
outsideClickButton="primary"
>
<div
- ref={menuRef}
+ data-remotion-menu-tree-id={menuTreeId}
style={portalStyle}
onPointerDown={onMenuPointerDown}
>
- <MenuContent
- onNextMenu={noop}
- onPreviousMenu={noop}
- values={opened.values}
- onHide={onHide}
- leaveLeftSpace
- preselectIndex={false}
- topItemCanBeUnselected={false}
- fixedHeight={null}
- />
+ <MenuTreeContext.Provider value={menuTreeId}>
+ <MenuContent
+ onNextMenu={noop}
+ onPreviousMenu={noop}
+ values={opened.values}
+ onHide={onHide}
+ leaveLeftSpace
+ preselectIndex={false}
+ topItemCanBeUnselected={false}
+ fixedHeight={null}
+ />
+ </MenuTreeContext.Provider>
</div>
</HigherZIndex>
</div>
@@ -249,6 +257,7 @@ export const ContextMenu = React.forwardRef<HTMLDivElement, ContextMenuProps>(
) => {
const ref = useRef<HTMLDivElement>(null);
const idRef = useRef(nextContextMenuId++);
+ const menuTreeIdRef = useRef(getNextMenuTreeId());
const invocationRef = useRef(0);
const getItemsRef = useRef(getItems);
getItemsRef.current = getItems;
@@ -348,6 +357,7 @@ export const ContextMenu = React.forwardRef<HTMLDivElement, ContextMenuProps>(
</div>
{opened.type === 'open' ? (
<ContextMenuPortal
+ menuTreeId={menuTreeIdRef.current}
sizeSource={ref}
currentZIndex={currentZIndex}
onHide={onHide}
@@ -366,6 +376,7 @@ export const ContextMenuForTarget: React.FC<{
readonly getItems: ContextMenuItemsFactory;
}> = ({triggerRef, getItems}) => {
const idRef = useRef(nextContextMenuId++);
+ const menuTreeIdRef = useRef(getNextMenuTreeId());
const invocationRef = useRef(0);
const getItemsRef = useRef(getItems);
getItemsRef.current = getItems;
@@ -446,6 +457,7 @@ export const ContextMenuForTarget: React.FC<{
return opened.type === 'open' ? (
<ContextMenuPortal
+ menuTreeId={menuTreeIdRef.current}
sizeSource={body}
currentZIndex={currentZIndex}
onHide={onHide}
diff --git a/packages/studio/src/components/InspectorLocationCopy.tsx b/packages/studio/src/components/InspectorLocationCopy.tsx
index 2759e7681d..658bad6f16 100644
--- a/packages/studio/src/components/InspectorLocationCopy.tsx
+++ b/packages/studio/src/components/InspectorLocationCopy.tsx
@@ -1,6 +1,6 @@
import React, {useCallback, useMemo, useState} from 'react';
import type {OriginalPosition} from '../error-overlay/react-overlay/utils/get-source-map';
-import {formatLocationForAgents} from '../helpers/format-file-location';
+import {formatContextForAgents} from '../helpers/format-file-location';
import {ClipboardIcon} from '../icons/clipboard';
import type {RenderInlineAction} from './InlineAction';
import {InlineAction} from './InlineAction';
@@ -46,8 +46,8 @@ export const InspectorLocationCopy: React.FC<{
}> = ({children, location, name, openInEditorLocation}) => {
const [hovered, setHovered] = useState(false);
const [focusedWithin, setFocusedWithin] = useState(false);
- const textToCopy = useMemo(() => {
- return formatLocationForAgents({
+ const contextForAgents = useMemo(() => {
+ return formatContextForAgents({
location,
name,
root: window.remotion_cwd,
@@ -61,18 +61,18 @@ export const InspectorLocationCopy: React.FC<{
const onCopy: React.MouseEventHandler<HTMLButtonElement> = useCallback(
(event) => {
event.stopPropagation();
- if (!textToCopy) {
+ if (!contextForAgents) {
return;
}
- navigator.clipboard.writeText(textToCopy).catch((err) => {
+ navigator.clipboard.writeText(contextForAgents).catch((err) => {
showNotification(
`Could not copy to clipboard: ${(err as Error).message}`,
2000,
);
});
},
- [textToCopy],
+ [contextForAgents],
);
const showAction = hovered || focusedWithin;
@@ -88,7 +88,7 @@ export const InspectorLocationCopy: React.FC<{
onBlur={() => setFocusedWithin(false)}
>
<div style={content}>{children}</div>
- {textToCopy || openInEditorLocation ? (
+ {contextForAgents || openInEditorLocation ? (
<div
style={{
...action,
@@ -97,15 +97,15 @@ export const InspectorLocationCopy: React.FC<{
}}
>
<InspectorOpenInEditor
+ contextForAgents={contextForAgents}
location={openInEditorLocation}
- prompt={textToCopy}
/>
- {textToCopy ? (
+ {contextForAgents ? (
<InlineAction
variant={null}
onClick={onCopy}
renderAction={renderCopyAction}
- title="Copy location for agents"
+ title="Copy context for agents"
/>
) : null}
</div>
diff --git a/packages/studio/src/components/InspectorOpenInEditor.tsx b/packages/studio/src/components/InspectorOpenInEditor.tsx
index 040a60580c..7f331d3717 100644
--- a/packages/studio/src/components/InspectorOpenInEditor.tsx
+++ b/packages/studio/src/components/InspectorOpenInEditor.tsx
@@ -17,7 +17,7 @@ import {CaretDown} from '../icons/caret';
import {EditorIcon} from '../icons/editor';
import {SetSelectedModalContext} from '../state/modals';
import {useZIndex} from '../state/z-index';
-import {CodingAgentIcon} from './CodingAgentIcon';
+import {getOpenInMenuItems} from './get-open-in-menu-items';
import type {RenderInlineAction} from './InlineAction';
import {InlineDropdown} from './InlineDropdown';
import type {ComboboxValue} from './NewComposition/ComboBox';
@@ -56,21 +56,13 @@ const mainButtonBase: React.CSSProperties = {
whiteSpace: 'nowrap',
};
-const menuLabel: React.CSSProperties = {
- color: 'inherit',
- fontFamily: 'sans-serif',
- fontSize: 13,
- lineHeight: '16px',
-};
-
const editorButtonIconSize = 18;
-const editorMenuIconSize = 18;
export const InspectorOpenInEditor: React.FC<{
+ readonly contextForAgents?: string | null;
readonly location: OriginalPosition | null;
readonly label?: React.ReactNode;
- readonly prompt?: string | null;
-}> = ({label, location, prompt = null}) => {
+}> = ({contextForAgents = null, label, location}) => {
const {previewServerState} = useContext(StudioServerConnectionCtx);
const {setSelectedModal} = useContext(SetSelectedModalContext);
const {tabIndex} = useZIndex();
@@ -103,7 +95,7 @@ export const InspectorOpenInEditor: React.FC<{
try {
const response = await openInCodingAgent(
codingAgentId,
- codingAgentId === 'copilot' ? null : prompt,
+ codingAgentId === 'copilot' ? null : contextForAgents,
);
if (!response.success) {
showNotification(`Could not open ${codingAgentName}`, 2000);
@@ -112,7 +104,7 @@ export const InspectorOpenInEditor: React.FC<{
showNotification((err as Error).message, 2000);
}
},
- [prompt],
+ [contextForAgents],
);
const editorName = window.remotion_editorName ?? 'default editor';
const canOpenDefault =
@@ -153,81 +145,33 @@ export const InspectorOpenInEditor: React.FC<{
return <CaretDown color={color} small />;
}, []);
const menuItems = useMemo((): ComboboxValue[] => {
- const alternateEditors: ComboboxValue[] = (
- editorInfo?.installedEditors ?? []
- )
- .filter((editor) => editor.id !== preferredEditorId)
- .map((editor) => ({
- id: `open-in-${editor.id}`,
- keyHint: null,
- label: <span style={menuLabel}>{editor.name}</span>,
- leftItem: <EditorIcon editorId={editor.id} size={editorMenuIconSize} />,
- onClick: () => {
- openWithEditor(editor.id).catch(() => undefined);
- },
- quickSwitcherLabel: null,
- subMenu: null,
- type: 'item' as const,
- value: editor.id,
- }));
- const codingAgents: ComboboxValue[] = (
- codingAgentInfo?.installedCodingAgents ?? []
- ).map((codingAgent) => ({
- id: `open-in-coding-agent-${codingAgent.id}`,
- keyHint: null,
- label: <span style={menuLabel}>{codingAgent.name}</span>,
- leftItem: <CodingAgentIcon iconDataUrl={codingAgent.iconDataUrl} />,
- onClick: () => {
- openWithCodingAgent(codingAgent.id, codingAgent.name).catch(
+ return getOpenInMenuItems({
+ codingAgentInfo,
+ editorDisabled: location === null,
+ editorInfo,
+ excludeCodingAgentId: null,
+ excludeEditorId: preferredEditorId,
+ onConfigureApps: () => {
+ setSelectedModal({
+ type: 'settings',
+ initialTab: 'apps',
+ initialPublicLicenseKey:
+ window.remotion_renderDefaults?.publicLicenseKey ?? null,
+ });
+ },
+ onOpenInCodingAgent: (codingAgentId, codingAgentName) => {
+ openWithCodingAgent(codingAgentId, codingAgentName).catch(
() => undefined,
);
},
- quickSwitcherLabel: null,
- subMenu: null,
- type: 'item' as const,
- value: `coding-agent-${codingAgent.id}`,
- }));
- const editorSection: ComboboxValue[] = alternateEditors.length
- ? [
- {type: 'section-header', id: 'editors-header', label: 'Editors'},
- ...alternateEditors,
- ]
- : [];
- const codingAgentSection: ComboboxValue[] = codingAgents.length
- ? [
- {type: 'section-header', id: 'agents-header', label: 'Agents'},
- ...codingAgents,
- ]
- : [];
- const apps: ComboboxValue[] = [...editorSection, ...codingAgentSection];
- const settingsItems: ComboboxValue[] = [
- ...(apps.length > 0
- ? [{type: 'divider' as const, id: 'editor-settings-divider'}]
- : []),
- {
- id: 'change-default-apps',
- keyHint: null,
- label: <span style={menuLabel}>Change default apps...</span>,
- leftItem: null,
- onClick: () => {
- setSelectedModal({
- type: 'settings',
- initialTab: 'apps',
- initialPublicLicenseKey:
- window.remotion_renderDefaults?.publicLicenseKey ?? null,
- });
- },
- quickSwitcherLabel: null,
- subMenu: null,
- type: 'item' as const,
- value: 'change-default-apps',
+ onOpenInEditor: (editorId) => {
+ openWithEditor(editorId).catch(() => undefined);
},
- ];
-
- return [...apps, ...settingsItems];
+ });
}, [
- codingAgentInfo?.installedCodingAgents,
- editorInfo?.installedEditors,
+ codingAgentInfo,
+ editorInfo,
+ location,
openWithCodingAgent,
openWithEditor,
preferredEditorId,
diff --git a/packages/studio/src/components/InspectorPanel/SequenceInspectorHeader.tsx b/packages/studio/src/components/InspectorPanel/SequenceInspectorHeader.tsx
index be229247e9..a4993bba21 100644
--- a/packages/studio/src/components/InspectorPanel/SequenceInspectorHeader.tsx
+++ b/packages/studio/src/components/InspectorPanel/SequenceInspectorHeader.tsx
@@ -8,7 +8,7 @@ import {InspectorInfoHeader} from '../InspectorInfoHeader';
import {InspectorLocationCopy} from '../InspectorLocationCopy';
import {InspectorSourceLocation} from '../InspectorSourceLocation';
import {COMPACT_INLINE_ROW_HEIGHT} from '../layout';
-import {useOpenSequenceInEditor} from '../Timeline/use-open-sequence-in-editor';
+import {useOpenSequenceInApps} from '../Timeline/use-open-sequence-in-apps';
import {useRenameSequence} from '../Timeline/use-rename-sequence';
import {
InspectorInlineAction,
@@ -57,7 +57,7 @@ export const useSequenceInspectorSourceLocation = (
sequence: TimelineTrackData['sequence'],
): SequenceInspectorSourceLocation => {
const {canOpenInEditor, openInEditor, originalLocation} =
- useOpenSequenceInEditor(sequence);
+ useOpenSequenceInApps(sequence);
const validatedLocation = useMemo(() => {
if (
diff --git a/packages/studio/src/components/Menu/SubMenu.tsx b/packages/studio/src/components/Menu/SubMenu.tsx
index a107950188..08b932562c 100644
--- a/packages/studio/src/components/Menu/SubMenu.tsx
+++ b/packages/studio/src/components/Menu/SubMenu.tsx
@@ -1,9 +1,10 @@
-import React, {useCallback} from 'react';
+import React, {useCallback, useContext} from 'react';
import {useMobileLayout} from '../../helpers/mobile-layout';
import {noop} from '../../helpers/noop';
import {HigherZIndex} from '../../state/z-index';
import type {SubMenu} from '../NewComposition/ComboBox';
import {MenuContent} from '../NewComposition/MenuContent';
+import {isNodeInMenuTree, MenuTreeContext} from './menu-tree-context';
import type {SubMenuActivated} from './MenuSubItem';
import {portals} from './portals';
@@ -21,15 +22,26 @@ export const SubMenuComponent: React.FC<{
onQuitSubMenu,
}) => {
const mobileLayout = useMobileLayout();
+ const menuTreeId = useContext(MenuTreeContext);
const onOutsideClick = useCallback(
(e: Node) => {
+ if (menuTreeId !== null) {
+ if (isNodeInMenuTree(e, menuTreeId)) {
+ onQuitSubMenu();
+ } else {
+ onQuitFullMenu();
+ }
+
+ return;
+ }
+
if (portals.find((p) => p.contains(e)) || mobileLayout) {
onQuitSubMenu();
} else {
onQuitFullMenu();
}
},
- [mobileLayout, onQuitFullMenu, onQuitSubMenu],
+ [menuTreeId, mobileLayout, onQuitFullMenu, onQuitSubMenu],
);
const onPointerDown = useCallback((e: React.PointerEvent<HTMLDivElement>) => {
@@ -40,6 +52,7 @@ export const SubMenuComponent: React.FC<{
return (
<HigherZIndex onEscape={onQuitFullMenu} onOutsideClick={onOutsideClick}>
<div
+ data-remotion-menu-tree-id={menuTreeId ?? undefined}
style={portalStyle}
className="css-reset"
onPointerDown={onPointerDown}
diff --git a/packages/studio/src/components/Menu/menu-tree-context.ts b/packages/studio/src/components/Menu/menu-tree-context.ts
new file mode 100644
index 0000000000..564372b283
--- /dev/null
+++ b/packages/studio/src/components/Menu/menu-tree-context.ts
@@ -0,0 +1,14 @@
+import {createContext} from 'react';
+
+let nextMenuTreeId = 0;
+
+export const getNextMenuTreeId = () => nextMenuTreeId++;
+
+export const MenuTreeContext = createContext<number | null>(null);
+
+export const isNodeInMenuTree = (node: Node, menuTreeId: number) => {
+ const element = node instanceof Element ? node : node.parentElement;
+ return (
+ element?.closest(`[data-remotion-menu-tree-id="${menuTreeId}"]`) !== null
+ );
+};
diff --git a/packages/studio/src/components/NewComposition/MenuContent.tsx b/packages/studio/src/components/NewComposition/MenuContent.tsx
index 43c0a93cda..e277c3456e 100644
--- a/packages/studio/src/components/NewComposition/MenuContent.tsx
+++ b/packages/studio/src/components/NewComposition/MenuContent.tsx
@@ -1,10 +1,18 @@
import type {PointerEvent, SetStateAction} from 'react';
-import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react';
+import React, {
+ useCallback,
+ useContext,
+ useEffect,
+ useMemo,
+ useRef,
+ useState,
+} from 'react';
import {BLACK_ALPHA_60} from '../../helpers/colors';
import {useMobileLayout} from '../../helpers/mobile-layout';
import {getStudioKeyboardShortcutsEnabled} from '../../helpers/studio-runtime-config';
import {useKeybinding} from '../../helpers/use-keybinding';
import {VERTICAL_SCROLLBAR_CLASSNAME} from '../Menu/is-menu-item';
+import {getNextMenuTreeId, MenuTreeContext} from '../Menu/menu-tree-context';
import {MenuDivider} from '../Menu/MenuDivider';
import type {MenuId} from '../Menu/MenuItem';
import {MenuSectionHeader} from '../Menu/MenuSectionHeader';
@@ -53,6 +61,9 @@ export const MenuContent: React.FC<{
}) => {
const keybindings = useKeybinding();
const containerRef = useRef<HTMLDivElement>(null);
+ const inheritedMenuTreeId = useContext(MenuTreeContext);
+ const localMenuTreeId = useRef(getNextMenuTreeId());
+ const menuTreeId = inheritedMenuTreeId ?? localMenuTreeId.current;
const isMobileLayout = useMobileLayout();
const [subMenuActivated, setSubMenuActivated] =
@@ -392,51 +403,54 @@ export const MenuContent: React.FC<{
}, [onHide, subMenuActivated]);
return (
- <div
- ref={containerRef}
- style={containerWithHeight}
- className={VERTICAL_SCROLLBAR_CLASSNAME}
- >
- {values.map((item) => {
- if (item.type === 'divider') {
- return <MenuDivider key={item.id} />;
- }
-
- if (item.type === 'section-header') {
- return (
- <MenuSectionHeader key={item.id}>{item.label}</MenuSectionHeader>
- );
- }
+ <MenuTreeContext.Provider value={menuTreeId}>
+ <div
+ ref={containerRef}
+ data-remotion-menu-tree-id={menuTreeId}
+ style={containerWithHeight}
+ className={VERTICAL_SCROLLBAR_CLASSNAME}
+ >
+ {values.map((item) => {
+ if (item.type === 'divider') {
+ return <MenuDivider key={item.id} />;
+ }
- const onClick = (id: string, e: PointerEvent<HTMLDivElement>) => {
- item.onClick(id, e);
- if (item.subMenu) {
- return null;
+ if (item.type === 'section-header') {
+ return (
+ <MenuSectionHeader key={item.id}>{item.label}</MenuSectionHeader>
+ );
}
- onHide();
- };
-
- return (
- <MenuSubItem
- key={item.id}
- selected={item.id === selectedItem}
- onActionChosen={onClick}
- onItemSelected={onItemSelected}
- label={item.label}
- id={item.id}
- keyHint={item.keyHint}
- leaveLeftSpace={leaveLeftSpace}
- leftItem={item.leftItem}
- subMenu={item.subMenu}
- onQuitMenu={onHide}
- onNextMenu={onNextMenu}
- subMenuActivated={subMenuActivated}
- setSubMenuActivated={setSubMenuActivated}
- disabled={item.disabled}
- />
- );
- })}
- </div>
+ const onClick = (id: string, e: PointerEvent<HTMLDivElement>) => {
+ item.onClick(id, e);
+ if (item.subMenu) {
+ return null;
+ }
+
+ onHide();
+ };
+
+ return (
+ <MenuSubItem
+ key={item.id}
+ selected={item.id === selectedItem}
+ onActionChosen={onClick}
+ onItemSelected={onItemSelected}
+ label={item.label}
+ id={item.id}
+ keyHint={item.keyHint}
+ leaveLeftSpace={leaveLeftSpace}
+ leftItem={item.leftItem}
+ subMenu={item.subMenu}
+ onQuitMenu={onHide}
+ onNextMenu={onNextMenu}
+ subMenuActivated={subMenuActivated}
+ setSubMenuActivated={setSubMenuActivated}
+ disabled={item.disabled}
+ />
+ );
+ })}
+ </div>
+ </MenuTreeContext.Provider>
);
};
diff --git a/packages/studio/src/components/SelectedOutlineElement.tsx b/packages/studio/src/components/SelectedOutlineElement.tsx
index 0969cf092f..9c86fde633 100644
--- a/packages/studio/src/components/SelectedOutlineElement.tsx
+++ b/packages/studio/src/components/SelectedOutlineElement.tsx
@@ -9,11 +9,13 @@ import {
TIMELINE_DROP_BLUE_ALPHA_12,
TRANSPARENT,
} from '../helpers/colors';
-import {formatFileLocation} from '../helpers/format-file-location';
import {getConnectedCompositions} from '../helpers/get-connected-compositions';
import {getSequenceDoubleClickAction} from '../helpers/get-sequence-double-click-action';
import {isStudioInteractivityEnabled} from '../helpers/interactivity-enabled';
-import {openOriginalPositionInEditor} from '../helpers/open-in-editor';
+import {
+ openInCodingAgent as launchCodingAgent,
+ openOriginalPositionInEditor,
+} from '../helpers/open-in-editor';
import {startPointerSession} from '../helpers/pointer-session';
import {EditorSnappingContext} from '../state/editor-snapping';
import {SetSelectedModalContext} from '../state/modals';
@@ -116,6 +118,11 @@ import {
parsedTransformOriginToUv,
serializeTransformOrigin,
} from './Timeline/transform-origin-utils';
+import {
+ canUseEditorPicker,
+ useDefaultCodingAgentInfo,
+ useDefaultEditorInfo,
+} from './use-default-editor-info';
import {useSelectAsset} from './use-select-asset';
export const SelectedOutlineTransformOriginHandle: React.FC<{
@@ -1487,6 +1494,11 @@ export const SelectedOutlineElement: React.FC<{
target,
}) => {
const {previewServerState} = useContext(StudioServerConnectionCtx);
+ const canConfigureApps = canUseEditorPicker(
+ previewServerState.type === 'connected',
+ );
+ const editorInfo = useDefaultEditorInfo(canConfigureApps);
+ const codingAgentInfo = useDefaultCodingAgentInfo(canConfigureApps);
const {setPropStatuses} = useContext(Internals.VisualModeSettersContext);
const updateResolvedStackTrace = useContext(
Internals.SequenceStackTracesUpdateContext,
@@ -1578,10 +1590,6 @@ export const SelectedOutlineElement: React.FC<{
const originalLocation = await resolveOriginalLocation(target);
- const fileLocation = formatFileLocation({
- location: originalLocation,
- root: window.remotion_cwd,
- });
const nodePath = target.nodePathInfo.sequenceSubscriptionKey;
const mediaSrc =
target.sequence.type === 'audio' ||
@@ -1611,13 +1619,23 @@ export const SelectedOutlineElement: React.FC<{
return getSequenceContextMenuItems({
assetLinkInfo,
canOpenInEditor,
+ codingAgentInfo,
deleteDisabled: sourceEditDisabled,
disableInteractivityDisabled,
duplicateDisabled: sourceEditDisabled || isProgrammaticallyDuplicated,
- editorInfo: null,
- fileLocation,
+ editorInfo,
includeSourceEditItems: sourceEditingEnabled,
isProgrammaticallyDuplicated,
+ onConfigureApps: canConfigureApps
+ ? () => {
+ setSelectedModal({
+ type: 'settings',
+ initialTab: 'apps',
+ initialPublicLicenseKey:
+ window.remotion_renderDefaults?.publicLicenseKey ?? null,
+ });
+ }
+ : null,
onDeleteSequenceFromSource: async () => {
if (sourceEditDisabled || previewServerState.type !== 'connected') {
return;
@@ -1677,14 +1695,27 @@ export const SelectedOutlineElement: React.FC<{
() => undefined,
);
},
- openInEditor: () => {
+ openInCodingAgent: (codingAgentId, codingAgentName, contextForAgents) => {
+ launchCodingAgent(codingAgentId, contextForAgents)
+ .then((response) => {
+ if (!response.success) {
+ showNotification(`Could not open ${codingAgentName}`, 2000);
+ }
+ })
+ .catch((err) => {
+ showNotification((err as Error).message, 2000);
+ });
+ },
+ openInEditor: (editorId) => {
if (!originalLocation) {
return;
}
- openOriginalPositionInEditor(originalLocation, null).catch((err) => {
- showNotification((err as Error).message, 2000);
- });
+ openOriginalPositionInEditor(originalLocation, editorId).catch(
+ (err) => {
+ showNotification((err as Error).message, 2000);
+ },
+ );
},
originalLocation,
selectAsset,
@@ -1725,7 +1756,7 @@ export const SelectedOutlineElement: React.FC<{
type: 'item' as const,
id: 'crop',
keyHint: null,
- label: 'Crop',
+ label: isProgrammaticallyDuplicated ? 'Crop all' : 'Crop',
leftItem: null,
disabled: !canCrop,
onClick: () => {
@@ -1757,7 +1788,10 @@ export const SelectedOutlineElement: React.FC<{
: [],
});
}, [
+ canConfigureApps,
+ codingAgentInfo,
confirm,
+ editorInfo,
onSelect,
previewServerState,
resolveOriginalLocation,
diff --git a/packages/studio/src/components/Timeline/TimelineSequence.tsx b/packages/studio/src/components/Timeline/TimelineSequence.tsx
index 4b1dd5648a..fe5437cefe 100644
--- a/packages/studio/src/components/Timeline/TimelineSequence.tsx
+++ b/packages/studio/src/components/Timeline/TimelineSequence.tsx
@@ -1,4 +1,3 @@
-import type {EditorPickerId} from '@remotion/studio-shared';
import React, {useCallback, useContext, useMemo, useRef} from 'react';
import type {_InternalTypes, TSequence} from 'remotion';
import {Internals, useCurrentFrame} from 'remotion';
@@ -13,7 +12,6 @@ import {
WHITE_ALPHA_20,
WHITE_ALPHA_50,
} from '../../helpers/colors';
-import {formatFileLocation} from '../../helpers/format-file-location';
import {
getConnectedCompositionFrame,
getSequenceDoubleClickAction,
@@ -25,22 +23,18 @@ import {
import type {SequenceNodePathInfo} from '../../helpers/get-timeline-sequence-sort-key';
import {isStudioInteractivityEnabled} from '../../helpers/interactivity-enabled';
import {isVideoWithLastFrameHold} from '../../helpers/is-video-with-last-frame-hold';
-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 {SetSelectedModalContext} from '../../state/modals';
import {AudioWaveform} from '../AudioWaveform';
import {callApi} from '../call-api';
import {useConfirmationDialog} from '../ConfirmationDialog';
import {ContextMenu} from '../ContextMenu';
import {useSelectComposition} from '../InitialCompositionLoader';
import {showNotification} from '../Notifications/NotificationCenter';
-import {
- canUseEditorPicker,
- useDefaultEditorInfo,
-} from '../use-default-editor-info';
import {useSelectAsset} from '../use-select-asset';
import {disableSequenceInteractivity} from './disable-sequence-interactivity';
import {duplicateSequencesFromSource} from './duplicate-selected-timeline-item';
@@ -59,17 +53,17 @@ import {
} from './TimelineSelection';
import {TimelineSequenceFrame} from './TimelineSequenceFrame';
import {
- TimelineSequenceLeftEdgeDragHandle,
- TimelineSequenceRightEdgeDragHandle,
canResizeTimelineSequenceDuration,
isCascadingSequence,
isTimelineSequenceDurationDraggable,
isTimelineSequenceLeftEdgeDraggable,
+ TimelineSequenceLeftEdgeDragHandle,
+ TimelineSequenceRightEdgeDragHandle,
useTimelineSequenceFromDrag,
} from './TimelineSequenceRightEdgeDragHandle';
import {TimelineVideoInfo} from './TimelineVideoInfo';
import {TimelineWidthContext} from './TimelineWidthProvider';
-import {useResolveStackAndReactToChange} from './use-resolved-stack-react-to-change';
+import {useOpenSequenceInApps} from './use-open-sequence-in-apps';
import {getSequenceFreezeFrameMenuItem} from './use-sequence-freeze-frame-menu-item';
const TimelineSequenceFn: React.FC<{
@@ -274,7 +268,15 @@ const TimelineSequenceInner: React.FC<{
const effectiveMaxMediaDuration = s.loopDisplay ? null : maxMediaDuration;
const extendVideoLastFrame = isVideoWithLastFrameHold(s);
- const originalLocation = useResolveStackAndReactToChange(s.getStack);
+ const {
+ canOpenInEditor,
+ canConfigureApps,
+ codingAgentInfo,
+ editorInfo,
+ openInCodingAgent,
+ openInEditor,
+ originalLocation,
+ } = useOpenSequenceInApps(s);
const validatedLocation = useMemo(() => {
if (
!originalLocation ||
@@ -320,35 +322,12 @@ const TimelineSequenceInner: React.FC<{
const {previewServerState} = useContext(StudioServerConnectionCtx);
const previewConnected = previewServerState.type === 'connected';
const previewInteractive = previewConnected && isStudioInteractivityEnabled();
- const editorInfo = useDefaultEditorInfo(canUseEditorPicker(previewConnected));
const {setPropStatuses} = useContext(Internals.VisualModeSettersContext);
+ const {setSelectedModal} = useContext(SetSelectedModalContext);
const selectAsset = useSelectAsset();
const selectComposition = useSelectComposition();
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(
- (editorId: EditorPickerId | null) => {
- if (!canOpenInEditor || !originalLocation) {
- return;
- }
-
- openOriginalPositionInEditor(originalLocation, editorId).catch((err) => {
- showNotification((err as Error).message, 2000);
- });
- },
- [canOpenInEditor, originalLocation],
- );
const onSequenceDoubleClick = useCallback(
(e: React.MouseEvent<HTMLDivElement>) => {
if (isTimelineSelectionModifierEvent(e)) {
@@ -503,16 +482,27 @@ const TimelineSequenceInner: React.FC<{
return getSequenceContextMenuItems({
assetLinkInfo: mediaSrc ? getTimelineAssetLinkInfo(mediaSrc) : null,
canOpenInEditor,
+ codingAgentInfo,
deleteDisabled,
disableInteractivityDisabled,
duplicateDisabled,
editorInfo,
- fileLocation,
includeSourceEditItems: isStudioInteractivityEnabled(),
isProgrammaticallyDuplicated,
+ onConfigureApps: canConfigureApps
+ ? () => {
+ setSelectedModal({
+ type: 'settings',
+ initialTab: 'apps',
+ initialPublicLicenseKey:
+ window.remotion_renderDefaults?.publicLicenseKey ?? null,
+ });
+ }
+ : null,
onDeleteSequenceFromSource,
onDisableSequenceInteractivity,
onDuplicateSequenceFromSource,
+ openInCodingAgent,
openInEditor,
originalLocation,
selectAsset,
@@ -524,11 +514,12 @@ const TimelineSequenceInner: React.FC<{
});
}, [
canOpenInEditor,
+ canConfigureApps,
+ codingAgentInfo,
deleteDisabled,
disableInteractivityDisabled,
duplicateDisabled,
editorInfo,
- fileLocation,
isProgrammaticallyDuplicated,
mediaSrc,
nodePath,
@@ -536,6 +527,7 @@ const TimelineSequenceInner: React.FC<{
onDeleteSequenceFromSource,
onDisableSequenceInteractivity,
onDuplicateSequenceFromSource,
+ openInCodingAgent,
openInEditor,
originalLocation,
previewInteractive,
@@ -546,6 +538,7 @@ const TimelineSequenceInner: React.FC<{
selectable,
sequenceFrameOffset,
setPropStatuses,
+ setSelectedModal,
validatedLocation?.source,
]);
const {frozenFrame} = s;
diff --git a/packages/studio/src/components/Timeline/TimelineSequenceItem.tsx b/packages/studio/src/components/Timeline/TimelineSequenceItem.tsx
index 0781cc24c8..38e08beb67 100644
--- a/packages/studio/src/components/Timeline/TimelineSequenceItem.tsx
+++ b/packages/studio/src/components/Timeline/TimelineSequenceItem.tsx
@@ -16,7 +16,6 @@ import {
TIMELINE_DROP_BLUE_ALPHA_16,
WHITE,
} from '../../helpers/colors';
-import {formatFileLocation} from '../../helpers/format-file-location';
import {
getConnectedCompositionFrame,
getSequenceDoubleClickAction,
@@ -81,7 +80,7 @@ import {
useTimelineSelection,
} from './TimelineSelection';
import {TimelineSequenceName} from './TimelineSequenceName';
-import {useOpenSequenceInEditor} from './use-open-sequence-in-editor';
+import {useOpenSequenceInApps} from './use-open-sequence-in-apps';
import {useRenameSequence} from './use-rename-sequence';
import {getSequenceFreezeFrameMenuItem} from './use-sequence-freeze-frame-menu-item';
import {useTimelineSequenceHasExpandableContent} from './use-timeline-expanded-tree';
@@ -316,16 +315,15 @@ const TimelineSequenceItemInner: React.FC<{
const [sequenceDropRejection, setSequenceDropRejection] = useState<
string | null
>(null);
- const {canOpenInEditor, editorInfo, openInEditor, originalLocation} =
- useOpenSequenceInEditor(sequence);
- const fileLocation = useMemo(
- () =>
- formatFileLocation({
- location: originalLocation,
- root: window.remotion_cwd,
- }),
- [originalLocation],
- );
+ const {
+ canOpenInEditor,
+ canConfigureApps,
+ codingAgentInfo,
+ editorInfo,
+ openInCodingAgent,
+ openInEditor,
+ originalLocation,
+ } = useOpenSequenceInApps(sequence);
const validatedLocation = useMemo(() => {
if (
@@ -993,16 +991,27 @@ const TimelineSequenceItemInner: React.FC<{
return getSequenceContextMenuItems({
assetLinkInfo: mediaSrc ? getTimelineAssetLinkInfo(mediaSrc) : null,
canOpenInEditor,
+ codingAgentInfo,
deleteDisabled,
disableInteractivityDisabled,
duplicateDisabled,
editorInfo,
- fileLocation,
includeSourceEditItems: isStudioInteractivityEnabled(),
isProgrammaticallyDuplicated,
+ onConfigureApps: canConfigureApps
+ ? () => {
+ setSelectedModal({
+ type: 'settings',
+ initialTab: 'apps',
+ initialPublicLicenseKey:
+ window.remotion_renderDefaults?.publicLicenseKey ?? null,
+ });
+ }
+ : null,
onDeleteSequenceFromSource,
onDisableSequenceInteractivity,
onDuplicateSequenceFromSource,
+ openInCodingAgent,
openInEditor,
originalLocation,
selectAsset,
@@ -1031,7 +1040,7 @@ const TimelineSequenceItemInner: React.FC<{
type: 'item' as const,
id: 'crop',
keyHint: null,
- label: 'Crop',
+ label: isProgrammaticallyDuplicated ? 'Crop all' : 'Crop',
leftItem: null,
disabled: false,
onClick: onCrop,
@@ -1066,13 +1075,14 @@ const TimelineSequenceItemInner: React.FC<{
}, [
canAddEffect,
canCrop,
+ canConfigureApps,
canOpenInEditor,
canRenameThisSequence,
+ codingAgentInfo,
deleteDisabled,
disableInteractivityDisabled,
duplicateDisabled,
editorInfo,
- fileLocation,
isProgrammaticallyDuplicated,
mediaSrc,
nodePath,
@@ -1084,6 +1094,7 @@ const TimelineSequenceItemInner: React.FC<{
onDuplicateSequenceFromSource,
onRenameSequence,
onSelect,
+ openInCodingAgent,
openInEditor,
originalLocation,
previewInteractive,
@@ -1093,6 +1104,7 @@ const TimelineSequenceItemInner: React.FC<{
selectable,
sequence,
sequenceFrameOffset,
+ setSelectedModal,
setPropStatuses,
validatedLocation?.source,
]);
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 9f4f37ab56..ddb43b1a6d 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
@@ -1,11 +1,13 @@
+import type {DefaultCodingAgent} from '@remotion/renderer';
import type {
EditorPickerId,
+ GetDefaultCodingAgentInfoResponse,
GetDefaultEditorInfoResponse,
} from '@remotion/studio-shared';
-import {createElement} from 'react';
import type {ResolvedStackLocation, TSequence} from 'remotion';
import {NoReactInternals} from 'remotion/no-react';
-import {EditorIcon} from '../../icons/editor';
+import {formatContextForAgents} from '../../helpers/format-file-location';
+import {getOpenInMenuItems} from '../get-open-in-menu-items';
import type {ComboboxValue} from '../NewComposition/ComboBox';
import {showNotification} from '../Notifications/NotificationCenter';
import type {TimelineAssetLinkInfo} from './timeline-asset-link';
@@ -41,12 +43,14 @@ export const getSequenceContextMenuItems = ({
disableInteractivityDisabled,
duplicateDisabled,
isProgrammaticallyDuplicated,
- fileLocation,
includeSourceEditItems,
+ codingAgentInfo,
editorInfo,
+ onConfigureApps,
onDeleteSequenceFromSource,
onDisableSequenceInteractivity,
onDuplicateSequenceFromSource,
+ openInCodingAgent,
openInEditor,
originalLocation,
selectAsset,
@@ -59,12 +63,18 @@ export const getSequenceContextMenuItems = ({
readonly disableInteractivityDisabled: boolean;
readonly duplicateDisabled: boolean;
readonly isProgrammaticallyDuplicated: boolean;
- readonly fileLocation: string | null;
readonly includeSourceEditItems: boolean;
+ readonly codingAgentInfo: GetDefaultCodingAgentInfoResponse | null;
readonly editorInfo: GetDefaultEditorInfoResponse | null;
+ readonly onConfigureApps: (() => void) | null;
readonly onDeleteSequenceFromSource: () => void;
readonly onDisableSequenceInteractivity: () => void;
readonly onDuplicateSequenceFromSource: () => void;
+ readonly openInCodingAgent: (
+ codingAgentId: DefaultCodingAgent,
+ codingAgentName: string,
+ contextForAgents: string | null,
+ ) => void;
readonly openInEditor: (editorId: EditorPickerId | null) => void;
readonly originalLocation: ResolvedStackLocation | null;
readonly selectAsset: (src: string) => void;
@@ -72,10 +82,43 @@ export const getSequenceContextMenuItems = ({
readonly sourceActions?: readonly ComboboxValue[];
}): ComboboxValue[] => {
const editorName = window.remotion_editorName;
- const {documentationLink} = sequence;
const isInteractiveSvg =
sequence.controls?.componentIdentity === interactiveSvgComponentIdentity;
const installedEditors = editorInfo?.installedEditors ?? [];
+ const defaultEditorId =
+ installedEditors.find((editor) => editor.nameWithType === editorName)?.id ??
+ null;
+ const defaultCodingAgent = codingAgentInfo?.installedCodingAgents.find(
+ (codingAgent) => codingAgent.id === codingAgentInfo.defaultCodingAgent,
+ );
+ const contextForAgents = formatContextForAgents({
+ location: originalLocation,
+ name: sequence.displayName || sequence.controls?.componentName || null,
+ root: window.remotion_cwd,
+ });
+ const openInCodingAgentWithContext = (
+ codingAgentId: DefaultCodingAgent,
+ codingAgentName: string,
+ ) => {
+ openInCodingAgent(
+ codingAgentId,
+ codingAgentName,
+ codingAgentId === 'copilot' ? null : contextForAgents,
+ );
+ };
+
+ const openInMenuItems = onConfigureApps
+ ? getOpenInMenuItems({
+ codingAgentInfo,
+ editorDisabled: !canOpenInEditor || !originalLocation,
+ editorInfo,
+ excludeCodingAgentId: defaultCodingAgent?.id ?? null,
+ excludeEditorId: defaultEditorId,
+ onConfigureApps,
+ onOpenInCodingAgent: openInCodingAgentWithContext,
+ onOpenInEditor: openInEditor,
+ })
+ : [];
const items = [
editorName
@@ -92,54 +135,58 @@ export const getSequenceContextMenuItems = ({
value: 'open-in-editor',
}
: null,
- editorName && installedEditors.length > 0
+ defaultCodingAgent
+ ? {
+ type: 'item' as const,
+ id: 'open-in-default-coding-agent',
+ keyHint: null,
+ label: `Open in ${defaultCodingAgent.nameWithType}`,
+ leftItem: null,
+ disabled: false,
+ onClick: () =>
+ openInCodingAgentWithContext(
+ defaultCodingAgent.id,
+ defaultCodingAgent.nameWithType,
+ ),
+ quickSwitcherLabel: null,
+ subMenu: null,
+ value: 'open-in-default-coding-agent',
+ }
+ : null,
+ onConfigureApps
? {
type: 'item' as const,
- id: 'open-in-another-editor',
+ id: 'open-in-another-app',
keyHint: null,
label: 'Open in...',
leftItem: null,
- disabled: !canOpenInEditor || !originalLocation,
+ disabled: false,
onClick: () => undefined,
quickSwitcherLabel: null,
subMenu: {
- items: installedEditors.map((editor) => ({
- type: 'item' as const,
- id: `open-in-${editor.id}`,
- keyHint: null,
- label: editor.name,
- leftItem: createElement(EditorIcon, {
- editorId: editor.id,
- size: 18,
- }),
- disabled: false,
- onClick: () => openInEditor(editor.id),
- quickSwitcherLabel: null,
- subMenu: null,
- value: editor.id,
- })),
+ items: openInMenuItems,
leaveLeftSpace: true,
preselectIndex: false as const,
},
- value: 'open-in-another-editor',
+ value: 'open-in-another-app',
}
: null,
{
type: 'item' as const,
- id: 'copy-file-location',
+ id: 'copy-context-for-agents',
keyHint: null,
- label: 'Copy file location',
+ label: 'Copy context for agents',
leftItem: null,
- disabled: !fileLocation,
+ disabled: !contextForAgents,
onClick: () => {
- if (!fileLocation) {
+ if (!contextForAgents) {
return;
}
navigator.clipboard
- .writeText(fileLocation)
+ .writeText(contextForAgents)
.then(() => {
- showNotification('Copied file location to clipboard', 1000);
+ showNotification('Copied context for agents', 1000);
})
.catch((err) => {
showNotification(
@@ -150,24 +197,8 @@ export const getSequenceContextMenuItems = ({
},
quickSwitcherLabel: null,
subMenu: null,
- value: 'copy-file-location',
+ value: 'copy-context-for-agents',
},
- 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,
@@ -184,7 +215,7 @@ export const getSequenceContextMenuItems = ({
value: 'show-asset',
}
: null,
- documentationLink || assetLinkInfo
+ assetLinkInfo
? {
type: 'divider' as const,
id: 'sequence-link-divider',
diff --git a/packages/studio/src/components/Timeline/use-open-sequence-in-editor.ts b/packages/studio/src/components/Timeline/use-open-sequence-in-apps.ts
similarity index 55%
rename from packages/studio/src/components/Timeline/use-open-sequence-in-editor.ts
rename to packages/studio/src/components/Timeline/use-open-sequence-in-apps.ts
index 406c671cbd..e44e14fcc7 100644
--- a/packages/studio/src/components/Timeline/use-open-sequence-in-editor.ts
+++ b/packages/studio/src/components/Timeline/use-open-sequence-in-apps.ts
@@ -1,20 +1,27 @@
+import type {DefaultCodingAgent} from '@remotion/renderer';
import type {EditorPickerId} from '@remotion/studio-shared';
import {useCallback, useContext, useMemo} from 'react';
import type {TSequence} from 'remotion';
import {StudioServerConnectionCtx} from '../../helpers/client-id';
-import {openOriginalPositionInEditor} from '../../helpers/open-in-editor';
+import {
+ openInCodingAgent as launchCodingAgent,
+ openOriginalPositionInEditor,
+} from '../../helpers/open-in-editor';
import {showNotification} from '../Notifications/NotificationCenter';
import {
canUseEditorPicker,
+ useDefaultCodingAgentInfo,
useDefaultEditorInfo,
} from '../use-default-editor-info';
import {useResolveStackAndReactToChange} from './use-resolved-stack-react-to-change';
-export const useOpenSequenceInEditor = (sequence: TSequence) => {
+export const useOpenSequenceInApps = (sequence: TSequence) => {
const {previewServerState} = useContext(StudioServerConnectionCtx);
const previewConnected = previewServerState.type === 'connected';
const originalLocation = useResolveStackAndReactToChange(sequence.getStack);
- const editorInfo = useDefaultEditorInfo(canUseEditorPicker(previewConnected));
+ const editorPickerAvailable = canUseEditorPicker(previewConnected);
+ const editorInfo = useDefaultEditorInfo(editorPickerAvailable);
+ const codingAgentInfo = useDefaultCodingAgentInfo(editorPickerAvailable);
const canOpenInEditor = useMemo(
() =>
@@ -38,10 +45,33 @@ export const useOpenSequenceInEditor = (sequence: TSequence) => {
},
[canOpenInEditor, originalLocation],
);
+ const openInCodingAgent = useCallback(
+ async (
+ codingAgentId: DefaultCodingAgent,
+ codingAgentName: string,
+ contextForAgents: string | null,
+ ) => {
+ try {
+ const response = await launchCodingAgent(
+ codingAgentId,
+ contextForAgents,
+ );
+ if (!response.success) {
+ showNotification(`Could not open ${codingAgentName}`, 2000);
+ }
+ } catch (err) {
+ showNotification((err as Error).message, 2000);
+ }
+ },
+ [],
+ );
return {
canOpenInEditor,
+ canConfigureApps: editorPickerAvailable,
+ codingAgentInfo,
editorInfo,
+ openInCodingAgent,
openInEditor,
originalLocation,
};
diff --git a/packages/studio/src/components/get-open-in-menu-items.tsx b/packages/studio/src/components/get-open-in-menu-items.tsx
new file mode 100644
index 0000000000..f6ccdff99e
--- /dev/null
+++ b/packages/studio/src/components/get-open-in-menu-items.tsx
@@ -0,0 +1,112 @@
+import type {DefaultCodingAgent} from '@remotion/renderer';
+import type {
+ EditorPickerId,
+ GetDefaultCodingAgentInfoResponse,
+ GetDefaultEditorInfoResponse,
+} from '@remotion/studio-shared';
+import React from 'react';
+import {EditorIcon} from '../icons/editor';
+import {CodingAgentIcon} from './CodingAgentIcon';
+import type {ComboboxValue} from './NewComposition/ComboBox';
+
+const menuLabel: React.CSSProperties = {
+ color: 'inherit',
+ fontFamily: 'sans-serif',
+ fontSize: 13,
+ lineHeight: '16px',
+};
+
+export const getOpenInMenuItems = ({
+ codingAgentInfo,
+ editorDisabled,
+ editorInfo,
+ excludeCodingAgentId,
+ excludeEditorId,
+ onConfigureApps,
+ onOpenInCodingAgent,
+ onOpenInEditor,
+}: {
+ readonly codingAgentInfo: GetDefaultCodingAgentInfoResponse | null;
+ readonly editorDisabled: boolean;
+ readonly editorInfo: GetDefaultEditorInfoResponse | null;
+ readonly excludeCodingAgentId: DefaultCodingAgent | null;
+ readonly excludeEditorId: EditorPickerId | null;
+ readonly onConfigureApps: () => void;
+ readonly onOpenInCodingAgent: (
+ codingAgentId: DefaultCodingAgent,
+ codingAgentName: string,
+ ) => void;
+ readonly onOpenInEditor: (editorId: EditorPickerId) => void;
+}): ComboboxValue[] => {
+ const editors: ComboboxValue[] = (editorInfo?.installedEditors ?? [])
+ .filter((editor) => editor.id !== excludeEditorId)
+ .map((editor) => ({
+ disabled: editorDisabled,
+ id: `open-in-${editor.id}`,
+ keyHint: null,
+ label: <span style={menuLabel}>{editor.name}</span>,
+ leftItem: <EditorIcon editorId={editor.id} size={18} />,
+ onClick: () => {
+ if (!editorDisabled) {
+ onOpenInEditor(editor.id);
+ }
+ },
+ quickSwitcherLabel: null,
+ subMenu: null,
+ type: 'item' as const,
+ value: editor.id,
+ }));
+ const codingAgents: ComboboxValue[] = (
+ codingAgentInfo?.installedCodingAgents ?? []
+ )
+ .filter((codingAgent) => codingAgent.id !== excludeCodingAgentId)
+ .map((codingAgent) => ({
+ id: `open-in-coding-agent-${codingAgent.id}`,
+ keyHint: null,
+ label: <span style={menuLabel}>{codingAgent.name}</span>,
+ leftItem: <CodingAgentIcon iconDataUrl={codingAgent.iconDataUrl} />,
+ onClick: () =>
+ onOpenInCodingAgent(codingAgent.id, codingAgent.nameWithType),
+ quickSwitcherLabel: null,
+ subMenu: null,
+ type: 'item' as const,
+ value: `coding-agent-${codingAgent.id}`,
+ }));
+
+ return [
+ ...(editors.length > 0
+ ? [
+ {
+ type: 'section-header' as const,
+ id: 'editors-header',
+ label: 'Editors',
+ },
+ ...editors,
+ ]
+ : []),
+ ...(codingAgents.length > 0
+ ? [
+ {
+ type: 'section-header' as const,
+ id: 'agents-header',
+ label: 'Agents',
+ },
+ ...codingAgents,
+ ]
+ : []),
+ ...(editors.length > 0 || codingAgents.length > 0
+ ? [{type: 'divider' as const, id: 'open-in-settings-divider'}]
+ : []),
+ {
+ id: 'change-default-apps',
+ keyHint: null,
+ label: <span style={menuLabel}>Change default apps...</span>,
+ leftItem: null,
+ onClick: onConfigureApps,
+ quickSwitcherLabel: null,
+ subMenu: null,
+ type: 'item' as const,
+ value: 'change-default-apps',
+ },
+ ];
+};
diff --git a/packages/studio/src/components/use-default-editor-info.ts b/packages/studio/src/components/use-default-editor-info.ts
index ad6742a7e8..c3a32f3a61 100644
--- a/packages/studio/src/components/use-default-editor-info.ts
+++ b/packages/studio/src/components/use-default-editor-info.ts
@@ -18,7 +18,7 @@ export const getPreferredEditorId = (
): EditorPickerId | null => {
return (
editorInfo?.installedEditors.find(
- (editor) => editor.name === window.remotion_editorName,
+ (editor) => editor.nameWithType === window.remotion_editorName,
)?.id ?? null
);
};
diff --git a/packages/studio/src/helpers/format-file-location.ts b/packages/studio/src/helpers/format-file-location.ts
index ebc3ece030..9132275532 100644
--- a/packages/studio/src/helpers/format-file-location.ts
+++ b/packages/studio/src/helpers/format-file-location.ts
@@ -40,7 +40,7 @@ export const formatFileLocation = ({
return `${stripLeadingDotSlash(relativeSource)}:${location.line}`;
};
-export const formatLocationForAgents = ({
+export const formatContextForAgents = ({
name,
location,
root,
diff --git a/packages/studio/src/test/composition-menu-items.test.ts b/packages/studio/src/test/composition-menu-items.test.ts
index 1311520ac9..5b1056474e 100644
--- a/packages/studio/src/test/composition-menu-items.test.ts
+++ b/packages/studio/src/test/composition-menu-items.test.ts
@@ -34,7 +34,7 @@ const installTestWindowWithEditor = () => {
configurable: true,
value: {
remotion_cwd: '/project',
- remotion_editorName: 'VS Code',
+ remotion_editorName: 'Code',
},
});
};
@@ -132,8 +132,8 @@ test('editor actions use Open labels and are adjacent', () => {
throw new Error('Expected editor actions');
}
- expect(compositionItem.label).toBe('Open composition in VS Code');
- expect(componentItem.label).toBe('Open component in VS Code');
+ expect(compositionItem.label).toBe('Open composition in Code');
+ expect(componentItem.label).toBe('Open component in Code');
});
test('read-only composition menus keep navigation and copy actions enabled', () => {
diff --git a/packages/studio/src/test/folder-menu-items.test.ts b/packages/studio/src/test/folder-menu-items.test.ts
index 7fcb2874a5..21e0605066 100644
--- a/packages/studio/src/test/folder-menu-items.test.ts
+++ b/packages/studio/src/test/folder-menu-items.test.ts
@@ -20,7 +20,7 @@ test('read-only folder menus keep navigation and copy actions enabled', () => {
configurable: true,
value: {
remotion_cwd: '/project',
- remotion_editorName: 'VS Code',
+ remotion_editorName: 'Code',
},
});
const folder = {
diff --git a/packages/studio/src/test/format-file-location.test.ts b/packages/studio/src/test/format-file-location.test.ts
index fefa36ce96..8b95a7856b 100644
--- a/packages/studio/src/test/format-file-location.test.ts
+++ b/packages/studio/src/test/format-file-location.test.ts
@@ -1,7 +1,7 @@
import {expect, test} from 'bun:test';
import {
+ formatContextForAgents,
formatFileLocation,
- formatLocationForAgents,
} from '../helpers/format-file-location';
test('Should format file locations relative to the project root', () => {
@@ -73,9 +73,9 @@ test('Should not format missing file locations', () => {
).toBe(null);
});
-test('Should format composition locations for agents', () => {
+test('Should format composition context for agents', () => {
expect(
- formatLocationForAgents({
+ formatContextForAgents({
location: {
source: '/Users/example/video/src/Root.tsx',
line: 399,
@@ -86,9 +86,9 @@ test('Should format composition locations for agents', () => {
).toBe('keyframed-props-test in src/Root.tsx:399');
});
-test('Should format component locations for agents', () => {
+test('Should format component context for agents', () => {
expect(
- formatLocationForAgents({
+ formatContextForAgents({
location: {
source: '/Users/example/video/src/KeyframesPropsTest.tsx',
line: 67,
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 b0b3ed8474..dc43fa12cd 100644
--- a/packages/studio/src/test/sequence-context-menu-items.test.ts
+++ b/packages/studio/src/test/sequence-context-menu-items.test.ts
@@ -33,8 +33,12 @@ afterEach(() => {
});
const installTestWindow = () => {
- const testWindow: Pick<Window, 'open' | 'remotion_editorName'> = {
+ const testWindow: Pick<
+ Window,
+ 'open' | 'remotion_cwd' | 'remotion_editorName'
+ > = {
open: () => null,
+ remotion_cwd: '/project',
remotion_editorName: null,
};
@@ -71,22 +75,24 @@ const expectNoExtraDividers = (items: ComboboxValue[]) => {
}
};
-test('sequence context menu does not put two dividers between docs and rename', () => {
+test('sequence context menu normalizes dividers before source actions', () => {
installTestWindow();
const items = getSequenceContextMenuItems({
assetLinkInfo: null,
canOpenInEditor: false,
+ codingAgentInfo: null,
deleteDisabled: false,
disableInteractivityDisabled: false,
duplicateDisabled: false,
editorInfo: null,
- fileLocation: 'src/Video.tsx:10:2',
includeSourceEditItems: true,
isProgrammaticallyDuplicated: false,
+ onConfigureApps: null,
onDeleteSequenceFromSource: noop,
onDisableSequenceInteractivity: noop,
onDuplicateSequenceFromSource: noop,
+ openInCodingAgent: noop,
openInEditor: noop,
originalLocation: null,
selectAsset: noop,
@@ -98,16 +104,138 @@ test('sequence context menu does not put two dividers between docs and rename',
expectNoExtraDividers(items);
- const docsIndex = items.findIndex(
- (item) => item.id === 'open-component-docs',
+ const copyContextIndex = items.findIndex(
+ (item) => item.id === 'copy-context-for-agents',
);
const renameIndex = items.findIndex((item) => item.id === 'rename-sequence');
expect(
- items.slice(docsIndex + 1, renameIndex).map((item) => item.type),
+ items.slice(copyContextIndex + 1, renameIndex).map((item) => item.type),
).toEqual(['divider']);
});
+test('sequence context menu shares alternate apps without repeating defaults', () => {
+ installTestWindow();
+ window.remotion_editorName = 'Cursor Editor';
+
+ const openedEditors: Array<string | null> = [];
+ const openedCodingAgents: Array<{
+ readonly id: string;
+ readonly prompt: string | null;
+ }> = [];
+ let configured = false;
+ const items = getSequenceContextMenuItems({
+ assetLinkInfo: null,
+ canOpenInEditor: true,
+ codingAgentInfo: {
+ defaultCodingAgent: 'cursor',
+ installedCodingAgents: [
+ {
+ id: 'cursor',
+ name: 'Cursor',
+ nameWithType: 'Cursor Agent',
+ iconDataUrl: null,
+ },
+ {
+ id: 'claude-code',
+ name: 'Claude Code',
+ nameWithType: 'Claude Code',
+ iconDataUrl: null,
+ },
+ ],
+ },
+ deleteDisabled: false,
+ disableInteractivityDisabled: false,
+ duplicateDisabled: false,
+ editorInfo: {
+ defaultEditor: 'cursor',
+ installedEditors: [
+ {
+ id: 'cursor',
+ name: 'Cursor',
+ nameWithType: 'Cursor Editor',
+ },
+ {id: 'vscode', name: 'Code', nameWithType: 'Code'},
+ ],
+ },
+ includeSourceEditItems: false,
+ isProgrammaticallyDuplicated: false,
+ onConfigureApps: () => {
+ configured = true;
+ },
+ onDeleteSequenceFromSource: noop,
+ onDisableSequenceInteractivity: noop,
+ onDuplicateSequenceFromSource: noop,
+ openInCodingAgent: (codingAgentId, _codingAgentName, prompt) => {
+ openedCodingAgents.push({id: codingAgentId, prompt});
+ },
+ openInEditor: (editorId) => {
+ openedEditors.push(editorId);
+ },
+ originalLocation: {
+ column: 2,
+ line: 10,
+ source: '/project/src/Video.tsx',
+ },
+ selectAsset: noop,
+ sequence: {displayName: 'Intro card'} as TSequence,
+ });
+
+ expect(items.slice(0, 3).map((item) => item.id)).toEqual([
+ 'open-in-editor',
+ 'open-in-default-coding-agent',
+ 'open-in-another-app',
+ ]);
+ expect(items[0]?.type === 'item' ? items[0].label : null).toBe(
+ 'Open in Cursor Editor',
+ );
+ expect(items[1]?.type === 'item' ? items[1].label : null).toBe(
+ 'Open in Cursor Agent',
+ );
+ const openIn = items.find((item) => item.id === 'open-in-another-app');
+ if (openIn?.type !== 'item' || openIn.subMenu === null) {
+ throw new Error('Expected Open in submenu');
+ }
+
+ const submenuIds = openIn.subMenu.items.map((item) => item.id);
+ expect(submenuIds).toContain('open-in-vscode');
+ expect(submenuIds).toContain('open-in-coding-agent-claude-code');
+ expect(submenuIds).toContain('change-default-apps');
+ expect(submenuIds).not.toContain('open-in-cursor');
+ expect(submenuIds).not.toContain('open-in-coding-agent-cursor');
+
+ const defaultAgent = items.find(
+ (item) => item.id === 'open-in-default-coding-agent',
+ );
+ if (defaultAgent?.type !== 'item') {
+ throw new Error('Expected default coding agent item');
+ }
+
+ defaultAgent.onClick('open-in-default-coding-agent', null);
+ const claudeCode = openIn.subMenu.items.find(
+ (item) => item.id === 'open-in-coding-agent-claude-code',
+ );
+ if (claudeCode?.type !== 'item') {
+ throw new Error('Expected Claude Code menu item');
+ }
+
+ claudeCode.onClick('open-in-coding-agent-claude-code', null);
+ const configure = openIn.subMenu.items.find(
+ (item) => item.id === 'change-default-apps',
+ );
+ if (configure?.type !== 'item') {
+ throw new Error('Expected configure apps item');
+ }
+
+ configure.onClick('change-default-apps', null);
+ expect(openedEditors).toEqual([]);
+ expect(openedCodingAgents).toEqual([
+ {id: 'cursor', prompt: 'Intro card in src/Video.tsx:10'},
+ {id: 'claude-code', prompt: 'Intro card in src/Video.tsx:10'},
+ ]);
+ expect(configured).toBe(true);
+});
+
test('Interactive.Svg context menu can copy the rendered SVG', () => {
installTestWindow();
@@ -127,16 +255,18 @@ test('Interactive.Svg context menu can copy the rendered SVG', () => {
const items = getSequenceContextMenuItems({
assetLinkInfo: null,
canOpenInEditor: false,
+ codingAgentInfo: null,
deleteDisabled: false,
disableInteractivityDisabled: false,
duplicateDisabled: false,
editorInfo: null,
- fileLocation: 'src/Video.tsx:10:2',
includeSourceEditItems: true,
isProgrammaticallyDuplicated: false,
+ onConfigureApps: null,
onDeleteSequenceFromSource: noop,
onDisableSequenceInteractivity: noop,
onDuplicateSequenceFromSource: noop,
+ openInCodingAgent: noop,
openInEditor: noop,
originalLocation: null,
selectAsset: noop,
@@ -159,13 +289,7 @@ test('Interactive.Svg context menu can copy the rendered SVG', () => {
copySvg.onClick('copy-svg', null);
expect(copiedTexts).toEqual(['<svg><circle /></svg>']);
- const docsIndex = items.findIndex(
- (item) => item.id === 'open-component-docs',
- );
const copySvgIndex = items.findIndex((item) => item.id === 'copy-svg');
- expect(
- items.slice(docsIndex + 1, copySvgIndex).map((item) => item.type),
- ).toEqual(['divider']);
expect(items[copySvgIndex + 1]?.type).toBe('divider');
});
@@ -175,16 +299,18 @@ test('programmatically duplicated sequence menus apply actions to all instances'
const items = getSequenceContextMenuItems({
assetLinkInfo: null,
canOpenInEditor: false,
+ codingAgentInfo: null,
deleteDisabled: false,
disableInteractivityDisabled: false,
duplicateDisabled: false,
editorInfo: null,
- fileLocation: 'src/Video.tsx:10:2',
includeSourceEditItems: true,
isProgrammaticallyDuplicated: true,
+ onConfigureApps: null,
onDeleteSequenceFromSource: noop,
onDisableSequenceInteractivity: noop,
onDuplicateSequenceFromSource: noop,
+ openInCodingAgent: noop,
openInEditor: noop,
originalLocation: null,
selectAsset: noop,
@@ -207,16 +333,18 @@ test('read-only sequence menus only contain non-mutating actions', () => {
const items = getSequenceContextMenuItems({
assetLinkInfo: null,
canOpenInEditor: false,
+ codingAgentInfo: null,
deleteDisabled: true,
disableInteractivityDisabled: true,
duplicateDisabled: true,
editorInfo: null,
- fileLocation: 'src/Video.tsx:10:2',
includeSourceEditItems: false,
isProgrammaticallyDuplicated: false,
+ onConfigureApps: null,
onDeleteSequenceFromSource: noop,
onDisableSequenceInteractivity: noop,
onDuplicateSequenceFromSource: noop,
+ openInCodingAgent: noop,
openInEditor: noop,
originalLocation: null,
selectAsset: noop,
@@ -232,9 +360,7 @@ test('read-only sequence menus only contain non-mutating actions', () => {
});
expect(items.map((item) => item.id)).toEqual([
- 'copy-file-location',
- 'open-component-docs',
- 'sequence-link-divider',
+ 'copy-context-for-agents',
'copy-svg',
]);
});