2018-09-22 12:28:50 +00:00
|
|
|
'use strict'
|
|
|
|
|
2016-01-12 02:40:23 +00:00
|
|
|
if (process.platform === 'linux' && process.type === 'renderer') {
|
2016-01-14 18:35:29 +00:00
|
|
|
// On Linux we could not access clipboard in renderer process.
|
2018-12-05 18:07:32 +00:00
|
|
|
const { getRemote } = require('@electron/internal/renderer/remote')
|
|
|
|
module.exports = getRemote('clipboard')
|
2016-01-12 02:40:23 +00:00
|
|
|
} else {
|
2016-10-25 04:43:24 +00:00
|
|
|
const clipboard = process.atomBinding('clipboard')
|
|
|
|
|
|
|
|
// Read/write to find pasteboard over IPC since only main process is notified
|
|
|
|
// of changes
|
|
|
|
if (process.platform === 'darwin' && process.type === 'renderer') {
|
2019-02-06 17:53:29 +00:00
|
|
|
const ipcRendererUtils = require('@electron/internal/renderer/ipc-renderer-internal-utils')
|
2018-10-13 17:50:07 +00:00
|
|
|
|
2019-02-06 17:53:29 +00:00
|
|
|
clipboard.readFindText = (...args) => ipcRendererUtils.invokeSync('ELECTRON_BROWSER_CLIPBOARD_READ_FIND_TEXT', ...args)
|
|
|
|
clipboard.writeFindText = (...args) => ipcRendererUtils.invokeSync('ELECTRON_BROWSER_CLIPBOARD_WRITE_FIND_TEXT', ...args)
|
2016-10-25 04:43:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = clipboard
|
2016-01-12 02:40:23 +00:00
|
|
|
}
|