mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
Use async ipc call to write to selection clipboard
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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: ->
|
||||
|
||||
Reference in New Issue
Block a user