Merge pull request #1406 from ajaxorg/ime
fix chinese Ime handling on windows
This commit is contained in:
commit
342bb71a3a
4 changed files with 34 additions and 10 deletions
16
index.html
16
index.html
|
|
@ -947,7 +947,7 @@ oop.inherits(FoldMode, BaseFoldMode);
|
|||
<li>
|
||||
|
||||
<img src="https://www.decor-tab-creator.com/_files/decor_logo_white_new.png"
|
||||
style="position: relative; left: -5px; width: 111px;top: 29px;">
|
||||
style="position: relative; left: -5px; width: 111px;top: 20px;">
|
||||
<a href="https://www.decor-tab-creator.com">Decor</a>
|
||||
</li>
|
||||
<li>
|
||||
|
|
@ -956,7 +956,7 @@ oop.inherits(FoldMode, BaseFoldMode);
|
|||
<a href="http://www.divshot.com/">Divshot</a>
|
||||
</li>
|
||||
<li>
|
||||
<img src="https://codio.com/base/images/logo.png"
|
||||
<img src="https://codio.com/s/img/logo-beta-e0ba4559.png"
|
||||
style="position: relative; left: -4px; width: 110px;top: 16px;">
|
||||
<a href="https://codio.com/">Codio</a>
|
||||
</li>
|
||||
|
|
@ -972,6 +972,18 @@ oop.inherits(FoldMode, BaseFoldMode);
|
|||
style="position: relative; left: 4px; width: 96px;top: -17px;">
|
||||
<a href="http://multiPlay.io/">MultiPlay.io</a>
|
||||
</li>
|
||||
<li>
|
||||
<div class="text-logo" style="font-size: 18px;margin-left: -3px;">Codeshare.io</div>
|
||||
<a href="http://codeshare.io">Codeshare.io</a>
|
||||
</li>
|
||||
<li>
|
||||
<div class="text-logo" style="font-size: 23px;">Runnable</div>
|
||||
<a href="http://runnable.com">Runnable</a>
|
||||
</li>
|
||||
<li>
|
||||
<div class="text-logo" style="font-size: 22px;margin-left: -5px;">DocsCamp</div>
|
||||
<a href="http://docscamp.com/">DocsCamp</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://github.com/Gozala/sky-edit">Sky Edit</a>
|
||||
</li>
|
||||
|
|
|
|||
|
|
@ -294,7 +294,8 @@
|
|||
baseUrl: window.location.protocol + "//" + window.location.host + window.location.pathname.split("/").slice(0, -1).join("/"),
|
||||
paths: {
|
||||
ace: "lib/ace"
|
||||
}
|
||||
},
|
||||
waitSeconds: 30
|
||||
};
|
||||
</script>
|
||||
<script src="demo/kitchen-sink/require.js" data-main="demo/kitchen-sink/demo" type="text/javascript"></script>
|
||||
|
|
|
|||
|
|
@ -231,6 +231,7 @@ var TextInput = function(parentNode, host) {
|
|||
afterContextMenu = false;
|
||||
};
|
||||
var onInput = function(e) {
|
||||
// console.log("onInput", inComposition)
|
||||
if (inComposition)
|
||||
return;
|
||||
var data = text.value;
|
||||
|
|
@ -349,6 +350,8 @@ var TextInput = function(parentNode, host) {
|
|||
|
||||
// COMPOSITION
|
||||
var onCompositionStart = function(e) {
|
||||
if (inComposition) return;
|
||||
// console.log("onCompositionStart", inComposition)
|
||||
inComposition = {};
|
||||
host.onCompositionStart();
|
||||
setTimeout(onCompositionUpdate, 0);
|
||||
|
|
@ -362,6 +365,7 @@ var TextInput = function(parentNode, host) {
|
|||
};
|
||||
|
||||
var onCompositionUpdate = function() {
|
||||
// console.log("onCompositionUpdate", inComposition && JSON.stringify(text.value))
|
||||
if (!inComposition) return;
|
||||
host.onCompositionUpdate(text.value);
|
||||
if (inComposition.lastValue)
|
||||
|
|
@ -378,27 +382,34 @@ var TextInput = function(parentNode, host) {
|
|||
};
|
||||
|
||||
var onCompositionEnd = function(e) {
|
||||
// console.log("onCompositionEnd", inComposition &&inComposition.lastValue)
|
||||
var c = inComposition;
|
||||
inComposition = false;
|
||||
var timer = setTimeout(function() {
|
||||
var str = text.value.replace(/\x01/g, "");
|
||||
if (!inComposition && str == c.lastValue)
|
||||
// console.log(str, c.lastValue)
|
||||
if (inComposition)
|
||||
return
|
||||
else if (str == c.lastValue)
|
||||
resetValue();
|
||||
else if (!c.lastValue && str) {
|
||||
resetValue();
|
||||
sendText(str);
|
||||
}
|
||||
});
|
||||
inputHandler = function compositionInputHandler(str) {
|
||||
// console.log("onCompositionEnd", str, c.lastValue)
|
||||
clearTimeout(timer);
|
||||
str = str.replace(/\x01/g, "");
|
||||
if (str == c.lastValue)
|
||||
return "";
|
||||
if (!str) {
|
||||
if (c.lastValue)
|
||||
host.undo();
|
||||
}
|
||||
if (c.lastValue)
|
||||
host.undo();
|
||||
return str;
|
||||
}
|
||||
host.onCompositionEnd();
|
||||
host.removeListener("mousedown", onCompositionEnd);
|
||||
if (e.type == "compositionend") {
|
||||
if (e.type == "compositionend" && c.range) {
|
||||
host.selection.setRange(c.range);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -545,7 +545,7 @@ var VirtualRenderer = function(container, theme) {
|
|||
var w = this.characterWidth;
|
||||
if (this.$composition) {
|
||||
var val = this.textarea.value.replace(/^\x01+/, "");
|
||||
w *= this.session.$getStringScreenWidth(val)[0];
|
||||
w *= (this.session.$getStringScreenWidth(val)[0]+2);
|
||||
h += 2;
|
||||
posTop -= 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue