diff --git a/lib/ace/keyboard/textinput.js b/lib/ace/keyboard/textinput.js index dded6dc0..f4ecac17 100644 --- a/lib/ace/keyboard/textinput.js +++ b/lib/ace/keyboard/textinput.js @@ -101,18 +101,25 @@ var TextInput = function(parentNode, host) { }, 0); }; - var onCopy = function() { + var onCopy = function(e) { copied = true; - text.value = host.getCopyText(); + var copyText = host.getCopyText(); + if(copyText) + text.value = copyText; + else + e.preventDefault(); text.select(); - copied = true; setTimeout(sendText, 0); }; - var onCut = function() { + var onCut = function(e) { copied = true; - text.value = host.getCopyText(); - host.onCut(); + var copyText = host.getCopyText(); + if(copyText) { + text.value = copyText; + host.onCut(); + } else + e.preventDefault(); text.select(); setTimeout(sendText, 0); };