Files
hermes-agent/apps/desktop/electron/image-context-menu.ts
T
2026-08-15 00:36:15 -07:00

41 lines
802 B
TypeScript

export function imageContextMenuItems(params, actions) {
if (params.mediaType !== 'image' || !params.hasImageContents) {
return []
}
const items = []
const srcURL = params.srcURL || ''
if (srcURL) {
items.push({
label: 'Open Image',
click: () => {
if (!srcURL.startsWith('data:')) {
actions.openImage(srcURL)
}
},
enabled: !srcURL.startsWith('data:')
})
}
items.push({
label: 'Copy Image',
click: () => actions.copyImageAt(params.x, params.y)
})
if (srcURL) {
items.push(
{
label: 'Copy Image Address',
click: () => actions.copyImageAddress(srcURL)
},
{
label: 'Save Image As...',
click: () => actions.saveImage(srcURL)
}
)
}
return items
}