Commit 71202663 authored by Oleg Korshul's avatar Oleg Korshul

android backspace emulate

parent 9b2818bd
...@@ -165,6 +165,8 @@ ...@@ -165,6 +165,8 @@
this.virtualKeyboardClickTimeout = -1; this.virtualKeyboardClickTimeout = -1;
this.virtualKeyboardClickPrevent = false; this.virtualKeyboardClickPrevent = false;
this.AndroidKeyboardDetectBackspace = false;
} }
CTextInput.prototype = CTextInput.prototype =
...@@ -256,6 +258,7 @@ ...@@ -256,6 +258,7 @@
}; };
this.HtmlArea["onkeypress"] = function(e) this.HtmlArea["onkeypress"] = function(e)
{ {
oThis.AndroidKeyboardDetectBackspace = false;
if (oThis.IsDisableKeyPress == true) if (oThis.IsDisableKeyPress == true)
{ {
// macOS Sierra send keypress before copy event // macOS Sierra send keypress before copy event
...@@ -274,27 +277,33 @@ ...@@ -274,27 +277,33 @@
this.HtmlArea.addEventListener("input", function(e) this.HtmlArea.addEventListener("input", function(e)
{ {
oThis.AndroidKeyboardDetectBackspace = false;
return oThis.onInput(e); return oThis.onInput(e);
}, false); }, false);
this.HtmlArea.addEventListener("textInput", function(e) this.HtmlArea.addEventListener("textInput", function(e)
{ {
oThis.AndroidKeyboardDetectBackspace = false;
return oThis.onTextInput(e); return oThis.onTextInput(e);
}, false); }, false);
this.HtmlArea.addEventListener("text", function(e) this.HtmlArea.addEventListener("text", function(e)
{ {
oThis.AndroidKeyboardDetectBackspace = false;
return oThis.onTextInput(e); return oThis.onTextInput(e);
}, false); }, false);
this.HtmlArea.addEventListener("compositionstart", function(e) this.HtmlArea.addEventListener("compositionstart", function(e)
{ {
oThis.AndroidKeyboardDetectBackspace = false;
return oThis.onCompositionStart(e); return oThis.onCompositionStart(e);
}, false); }, false);
this.HtmlArea.addEventListener("compositionupdate", function(e) this.HtmlArea.addEventListener("compositionupdate", function(e)
{ {
oThis.AndroidKeyboardDetectBackspace = false;
return oThis.onCompositionUpdate(e); return oThis.onCompositionUpdate(e);
}, false); }, false);
this.HtmlArea.addEventListener("compositionend", function(e) this.HtmlArea.addEventListener("compositionend", function(e)
{ {
oThis.AndroidKeyboardDetectBackspace = false;
return oThis.onCompositionEnd(e); return oThis.onCompositionEnd(e);
}, false); }, false);
...@@ -1001,6 +1010,12 @@ ...@@ -1001,6 +1010,12 @@
onKeyDown : function(e) onKeyDown : function(e)
{ {
if (AscCommon.AscBrowser.isAndroid)
{
if (e.keyCode == 229 && e.charCode == 0 && e.key == "Unidentified")
this.AndroidKeyboardDetectBackspace = true;
}
this.isChromeKeysNoKeyPressPresent = false; this.isChromeKeysNoKeyPressPresent = false;
if (this.isSystem && this.isShow) if (this.isSystem && this.isShow)
{ {
...@@ -1096,6 +1111,9 @@ ...@@ -1096,6 +1111,9 @@
onKeyUp : function(e) onKeyUp : function(e)
{ {
this.isChromeKeysNoKeyPressPresent = false; this.isChromeKeysNoKeyPressPresent = false;
var oldAndroidKeyboardDetectBackspace = this.AndroidKeyboardDetectBackspace;
this.AndroidKeyboardDetectBackspace = false;
if (this.isSystem && this.isShow) if (this.isSystem && this.isShow)
return; return;
...@@ -1114,7 +1132,19 @@ ...@@ -1114,7 +1132,19 @@
} }
if (c_oCompositionState.end == this.compositionState) if (c_oCompositionState.end == this.compositionState)
{
if (AscCommon.AscBrowser.isAndroid && oldAndroidKeyboardDetectBackspace)
{
if (e.keyCode == 229 && e.charCode == 0 && e.key == "Unidentified")
{
// backspace? по-другому определить не могу
this.emulateKeyDownApi(8);
return false;
}
}
return this.Api.onKeyUp(e); return this.Api.onKeyUp(e);
}
if (AscCommon.AscBrowser.isChrome || if (AscCommon.AscBrowser.isChrome ||
AscCommon.AscBrowser.isSafari || AscCommon.AscBrowser.isSafari ||
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment