mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Rename to safe-clipboard
...and use remote only on Linux renderer processes.
This commit is contained in:
@@ -256,7 +256,7 @@ class AtomApplication
|
||||
|
||||
clipboard = null
|
||||
ipc.on 'write-text-to-selection-clipboard', (event, selectedText) ->
|
||||
clipboard ?= require '../native-clipboard'
|
||||
clipboard ?= require '../safe-clipboard'
|
||||
clipboard.writeText(selectedText, 'selection')
|
||||
|
||||
# Public: Executes the given command.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
crypto = require 'crypto'
|
||||
clipboard = require "./native-clipboard"
|
||||
clipboard = require "./safe-clipboard"
|
||||
|
||||
# Extended: Represents the clipboard used for copying and pasting in Atom.
|
||||
#
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
# Using clipboard in renderer process is not safe on Linux.
|
||||
module.exports =
|
||||
if process.platform is 'linux'
|
||||
require('remote').require 'clipboard'
|
||||
else
|
||||
require 'clipboard'
|
||||
6
src/safe-clipboard.coffee
Normal file
6
src/safe-clipboard.coffee
Normal file
@@ -0,0 +1,6 @@
|
||||
# Using clipboard in renderer process is not safe on Linux.
|
||||
module.exports =
|
||||
if process.platform is "linux" and process.type is "renderer"
|
||||
require("remote").require("clipboard")
|
||||
else
|
||||
require("clipboard")
|
||||
@@ -556,7 +556,7 @@ class TextEditorComponent
|
||||
|
||||
pasteSelectionClipboard = (event) =>
|
||||
if event?.which is 2 and process.platform is 'linux'
|
||||
if selection = require('./native-clipboard').readText('selection')
|
||||
if selection = require('./safe-clipboard').readText('selection')
|
||||
@editor.insertText(selection)
|
||||
|
||||
window.addEventListener('mousemove', onMouseMove)
|
||||
|
||||
Reference in New Issue
Block a user