2016-01-11 18:40:23 -08:00
|
|
|
if (process.platform === 'linux' && process.type === 'renderer') {
|
2016-01-14 10:35:29 -08:00
|
|
|
// On Linux we could not access clipboard in renderer process.
|
2016-03-25 12:41:24 -07:00
|
|
|
module.exports = require('electron').remote.clipboard
|
2016-01-11 18:40:23 -08:00
|
|
|
} else {
|
2018-02-21 07:53:48 -05:00
|
|
|
const {deprecate} = require('electron')
|
2016-10-25 13:43:24 +09:00
|
|
|
const clipboard = process.atomBinding('clipboard')
|
|
|
|
|
2018-02-21 07:53:48 -05:00
|
|
|
// TODO(codebytere): remove in 3.0
|
|
|
|
clipboard.readHtml = function () {
|
|
|
|
if (!process.noDeprecations) {
|
|
|
|
deprecate.warn('clipboard.readHtml', 'clipboard.readHTML')
|
|
|
|
}
|
|
|
|
return clipboard.readHTML()
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO(codebytere): remove in 3.0
|
|
|
|
clipboard.writeHtml = function () {
|
|
|
|
if (!process.noDeprecations) {
|
|
|
|
deprecate.warn('clipboard.writeHtml', 'clipboard.writeHTML')
|
|
|
|
}
|
|
|
|
return clipboard.writeHTML()
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO(codebytere): remove in 3.0
|
|
|
|
clipboard.readRtf = function () {
|
|
|
|
if (!process.noDeprecations) {
|
|
|
|
deprecate.warn('clipboard.readRtf', 'clipboard.writeRTF')
|
|
|
|
}
|
|
|
|
return clipboard.readRTF()
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO(codebytere): remove in 3.0
|
|
|
|
clipboard.writeRtf = function () {
|
|
|
|
if (!process.noDeprecations) {
|
|
|
|
deprecate.warn('clipboard.writeRtf', 'clipboard.writeRTF')
|
|
|
|
}
|
|
|
|
return clipboard.writeRTF()
|
|
|
|
}
|
|
|
|
|
2016-10-25 13:43:24 +09:00
|
|
|
// 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
|
2016-01-11 18:40:23 -08:00
|
|
|
}
|