1
0
mirror of https://github.com/h3poteto/whalebird-desktop synced 2025-01-30 17:15:16 +01:00

Fix broken clipboard

This commit is contained in:
AkiraFukushima 2023-01-23 00:57:09 +09:00
parent 52e1c7e1fb
commit 2a2ebfd0ae
No known key found for this signature in database
GPG Key ID: B6E51BAC4DE1A957
3 changed files with 7 additions and 4 deletions

View File

@ -14,7 +14,8 @@ import {
nativeTheme,
IpcMainInvokeEvent,
Notification,
NotificationConstructorOptions
NotificationConstructorOptions,
clipboard
} from 'electron'
import fs from 'fs'
import crypto from 'crypto'
@ -1445,3 +1446,7 @@ ipcMain.on('start-tag-streaming', async (event: IpcMainEvent, obj: TagStreamingO
ipcMain.handle('open-browser', async (_: IpcMainInvokeEvent, url: string) => {
shell.openExternal(url)
})
ipcMain.handle('copy-text', async (_: IpcMainInvokeEvent, text: string) => {
clipboard.writeText(text)
})

View File

@ -1,7 +1,5 @@
const electron = require('electron')
global.ipcRenderer = electron.ipcRenderer
global.shell = electron.shell
global.clipboard = electron.clipboard
global.node_env = process.env.NODE_ENV
global.platform = process.platform

View File

@ -522,7 +522,7 @@ export default defineComponent({
win.ipcRenderer.invoke('open-browser', message.url)
}
const copyLink = (message: Entity.Status) => {
;(window as any).clipboard.writeText(message.url, 'toot-link')
win.ipcRenderer.invoke('copy-text', message.url)
}
const reportUser = () => {
store.dispatch(`TimelineSpace/Modals/Report/${REPORT_ACTION.OPEN_REPORT}`, originalMessage.value)