don't copy empty strings

This commit is contained in:
nightwing 2011-01-28 21:36:59 +08:00 committed by Fabian Jakobs
commit fa5c7f3eb3

View file

@ -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);
};