diff --git a/src/browser/atom-application.coffee b/src/browser/atom-application.coffee index 402a3f3ed..46c000e8b 100644 --- a/src/browser/atom-application.coffee +++ b/src/browser/atom-application.coffee @@ -238,6 +238,11 @@ class AtomApplication win = BrowserWindow.fromWebContents(event.sender) win[method](args...) + clipboard = null + ipc.on 'write-text-to-selection-clipboard', (event, selectedText) -> + clipboard ?= require 'clipboard' + clipboard.writeText(selectedText) + # Public: Executes the given command. # # If it isn't handled globally, delegate to the currently focused window. diff --git a/src/text-editor-component.coffee b/src/text-editor-component.coffee index f124993f4..bc2ff3b2a 100644 --- a/src/text-editor-component.coffee +++ b/src/text-editor-component.coffee @@ -6,6 +6,7 @@ scrollbarStyle = require 'scrollbar-style' {Range, Point} = require 'text-buffer' grim = require 'grim' {CompositeDisposable} = require 'event-kit' +ipc = require 'ipc' GutterComponent = require './gutter-component' InputComponent = require './input-component' @@ -444,6 +445,7 @@ TextEditorComponent = React.createClass @subscribe @props.editor.onDidChangeSelectionRange => if selectedText = @props.editor.getSelectedText() + ipc.send('write-text-to-selection-clipboard', selectedText) clipboard.writeText(selectedText, 'selection') observeConfig: ->