From db264306c97d870f5492eae21dbddca3f56f27eb Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Tue, 24 Apr 2012 23:16:59 -0700 Subject: [PATCH] Get copy paste back --- lib/ace/editor.js | 4 ++++ lib/ace/keyboard/textinput.js | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/lib/ace/editor.js b/lib/ace/editor.js index 6945c533..51aa5015 100644 --- a/lib/ace/editor.js +++ b/lib/ace/editor.js @@ -430,6 +430,10 @@ var Editor = function(renderer, session) { return text; }; + this.onCopy = function() { + this.commands.exec("copy", this); + }; + this.onCut = function() { this.commands.exec("cut", this); }; diff --git a/lib/ace/keyboard/textinput.js b/lib/ace/keyboard/textinput.js index 6d840df3..3c514537 100644 --- a/lib/ace/keyboard/textinput.js +++ b/lib/ace/keyboard/textinput.js @@ -61,6 +61,7 @@ var TextInput = function(parentNode, host) { var copied = false; var pasted = false; var tempStyle = ''; + var outsideCopyText = ""; function select() { try { @@ -174,6 +175,11 @@ var TextInput = function(parentNode, host) { outsideCopyText = text.value; } + this.emitPaste = function() { + pasted = true; + sendText(outsideCopyText); + } + event.addCommandKeyListener(text, host.onCommandKey.bind(host)); if (useragent.isOldIE) {