From 81b6e5916a6fc8b4e7b6314170e1e4f5f57ae8c5 Mon Sep 17 00:00:00 2001 From: nightwing Date: Wed, 4 Jul 2012 17:57:35 +0400 Subject: [PATCH] fix text input for old ie --- lib/ace/keyboard/textinput.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/lib/ace/keyboard/textinput.js b/lib/ace/keyboard/textinput.js index 3f0cb9dc..af6fe1b7 100644 --- a/lib/ace/keyboard/textinput.js +++ b/lib/ace/keyboard/textinput.js @@ -166,7 +166,24 @@ var TextInput = function(parentNode, host) { }; event.addCommandKeyListener(text, host.onCommandKey.bind(host)); - event.addListener(text, "input", useragent.isIE ? onPropertyChange : onTextInput); + event.addListener(text, "input", onTextInput); + + if (useragent.isOldIE) { + var keytable = { 13:1, 27:1 }; + event.addListener(text, "keyup", function (e) { + if (inCompostion && (!text.value || keytable[e.keyCode])) + setTimeout(onCompositionEnd, 0); + if ((text.value.charCodeAt(0)|0) < 129) { + return; + } + inCompostion ? onCompositionUpdate() : onCompositionStart(); + }); + + event.addListener(text, "propertychange", function() { + if (text.value != PLACEHOLDER) + setTimeout(sendText, 0); + }); + } event.addListener(text, "paste", function(e) { // Mark that the next input text comes from past.