[IME] pressing enter on ie reverts last input

This commit is contained in:
nightwing 2013-10-10 12:59:58 +04:00
commit b52a989bf8

View file

@ -394,6 +394,7 @@ var TextInput = function(parentNode, host) {
var c = inComposition;
inComposition = false;
var timer = setTimeout(function() {
timer = null;
var str = text.value.replace(/\x01/g, "");
// console.log(str, c.lastValue)
if (inComposition)
@ -407,14 +408,15 @@ var TextInput = function(parentNode, host) {
});
inputHandler = function compositionInputHandler(str) {
// console.log("onCompositionEnd", str, c.lastValue)
clearTimeout(timer);
if (timer)
clearTimeout(timer);
str = str.replace(/\x01/g, "");
if (str == c.lastValue)
return "";
if (c.lastValue)
if (c.lastValue && timer)
host.undo();
return str;
}
};
host.onCompositionEnd();
host.removeListener("mousedown", onCompositionEnd);
if (e.type == "compositionend" && c.range) {