1
0
mirror of https://github.com/h3poteto/whalebird-desktop synced 2025-02-04 03:07:36 +01:00

refs #5097 Add context menu to save images

This commit is contained in:
AkiraFukushima 2024-12-14 00:50:26 +09:00
parent cbe26b9d27
commit 4fb636e91c
No known key found for this signature in database
GPG Key ID: B7EA3A3C9AEC9F0E
2 changed files with 29 additions and 11 deletions

View File

@ -39,6 +39,26 @@ let main: BrowserWindow = null
await mainWindow.loadURL(`http://localhost:${port}/`)
mainWindow.webContents.openDevTools()
}
mainWindow.webContents.on('context-menu', (_event, properties) => {
const contextMenu = Menu.buildFromTemplate([
{
label: 'Select All',
click: () => {
mainWindow.webContents.selectAll()
}
},
{
label: 'Save Image As',
visible: properties.mediaType === 'image',
click: () => {
console.log(properties.srcURL)
mainWindow.webContents.downloadURL(properties.srcURL)
}
}
])
contextMenu.popup({ window: mainWindow })
})
})()
app.on('window-all-closed', () => {

View File

@ -54,17 +54,15 @@ export default function FollowRequests(props: Props) {
</div>
<div className="timeline overflow-y-auto w-full overflow-x-hidden" style={{ height: 'calc(100% - 44px)' }}>
{requests.map(r => (
<>
<User
key={r.id}
user={r}
client={props.client}
refresh={async () => {
const data = await refreshRequests()
updateUnreads(data.length)
}}
/>
</>
<User
key={r.id}
user={r}
client={props.client}
refresh={async () => {
const data = await refreshRequests()
updateUnreads(data.length)
}}
/>
))}
</div>
</section>