Read/write find pasteboard text via IPC in renderer process

This commit is contained in:
Kevin Sawicki 2016-10-25 13:43:24 +09:00
Родитель 144a61c5a3
Коммит 1718697ef0
1 изменённых файлов: 10 добавлений и 1 удалений

Просмотреть файл

@ -2,5 +2,14 @@ if (process.platform === 'linux' && process.type === 'renderer') {
// On Linux we could not access clipboard in renderer process.
module.exports = require('electron').remote.clipboard
} else {
module.exports = process.atomBinding('clipboard')
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') {
clipboard.readFindText = require('electron').remote.clipboard.readFindText
clipboard.writeFindText = require('electron').remote.clipboard.writeFindText
}
module.exports = clipboard
}