Skip to content

Commit

Permalink
支持为切换输入状态绑定回调函数,修复部分拼音无法正常输入的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
baiyuanneko committed Feb 1, 2024
1 parent 04bfb2a commit 9f00fae
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion simple-input-method/simple-input-method.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ var SimpleInputMethod =
doublePinyinModeEnabled: false,
doublePinyinTypeIfEnabled: "",
isInEnglishMode: true,
callbackFuncWhenChangeEnglishMode: function(modeAfterChange){

},
doublePinyinMapping: {
"patterns": [
{
Expand Down Expand Up @@ -70,7 +73,7 @@ var SimpleInputMethod =
"uang": "else"
},
"x": {
"ia": ["q", "p", "j", "x"],
"ia": ["q", "p", "j", "x", "l"],
"ua": "else"
},
"v": {
Expand All @@ -84,6 +87,14 @@ var SimpleInputMethod =
"a": {
"": ["a"],
"a": "else"
},
"e": {
"": ["e"],
"e": "else"
},
"o": {
"": ["o"],
"o": "else"
}
}
}
Expand Down Expand Up @@ -270,16 +281,19 @@ var SimpleInputMethod =
{
that.isInEnglishMode = !that.isInEnglishMode;
preventDefault = true;
callbackFuncWhenChangeEnglishMode(that.isInEnglishMode);
}
else if(e.shiftKey)
{
that.isInEnglishMode = !that.isInEnglishMode;
preventDefault = true;
callbackFuncWhenChangeEnglishMode(that.isInEnglishMode);
}
else if(e.shiftKey && keyCode === 32)
{
that.isInEnglishMode = !that.isInEnglishMode;
preventDefault = true;
callbackFuncWhenChangeEnglishMode(that.isInEnglishMode);
}
else if(keyCode === 33 || keyCode === 189 || keyCode === 173 || keyCode === 34 || keyCode === 187 || keyCode === 61) {
preventDefault = true;
Expand Down

0 comments on commit 9f00fae

Please sign in to comment.