never send empty strings to the document
This commit is contained in:
parent
c4ccc2200f
commit
ce6bfe2f65
1 changed files with 7 additions and 5 deletions
|
|
@ -26,9 +26,11 @@ var TextInput = function(parentNode, host) {
|
||||||
if (!copied) {
|
if (!copied) {
|
||||||
var value = text.value;
|
var value = text.value;
|
||||||
if (value) {
|
if (value) {
|
||||||
if (value.charCodeAt(value.length-1) == PLACEHOLDER.charCodeAt(0))
|
if (value.charCodeAt(value.length-1) == PLACEHOLDER.charCodeAt(0)) {
|
||||||
host.onTextInput(value.slice(0, -1));
|
value = value.slice(0, -1);
|
||||||
else
|
if (value)
|
||||||
|
host.onTextInput(value);
|
||||||
|
} else
|
||||||
host.onTextInput(value);
|
host.onTextInput(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -41,7 +43,7 @@ var TextInput = function(parentNode, host) {
|
||||||
|
|
||||||
var onTextInput = function(e) {
|
var onTextInput = function(e) {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
if (!inCompostion)
|
if (!inCompostion)
|
||||||
sendText();
|
sendText();
|
||||||
}, 0);
|
}, 0);
|
||||||
};
|
};
|
||||||
|
|
@ -77,7 +79,7 @@ var TextInput = function(parentNode, host) {
|
||||||
host.onCut();
|
host.onCut();
|
||||||
text.select();
|
text.select();
|
||||||
};
|
};
|
||||||
|
|
||||||
event.addListener(text, "keypress", onTextInput);
|
event.addListener(text, "keypress", onTextInput);
|
||||||
event.addListener(text, "textInput", onTextInput);
|
event.addListener(text, "textInput", onTextInput);
|
||||||
event.addListener(text, "paste", onTextInput);
|
event.addListener(text, "paste", onTextInput);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue