Commit 44a2f21c authored by Oleg Korshul's avatar Oleg Korshul

input bugs

parent 132336ce
...@@ -106,6 +106,9 @@ ...@@ -106,6 +106,9 @@
this.compositionValue = []; // коды символов this.compositionValue = []; // коды символов
this.compositionState = c_oCompositionState.end; this.compositionState = c_oCompositionState.end;
this.compositionStateApi = c_oCompositionState.end;
this.DisableCompositeInput = false;
this.TargetId = null; // id caret this.TargetId = null; // id caret
this.HtmlDiv = null; // для незаметной реализации одной textarea недостаточно this.HtmlDiv = null; // для незаметной реализации одной textarea недостаточно
...@@ -342,10 +345,12 @@ ...@@ -342,10 +345,12 @@
putAreaValue : function(val) putAreaValue : function(val)
{ {
this.DisableCompositeInput = true;
if (this.TextArea_Not_ContentEditableDiv) if (this.TextArea_Not_ContentEditableDiv)
this.HtmlArea.value = val; this.HtmlArea.value = val;
else else
this.HtmlArea.innerHTML = val; this.HtmlArea.innerHTML = val;
this.DisableCompositeInput = false;
}, },
getAreaValue : function() getAreaValue : function()
...@@ -525,17 +530,17 @@ ...@@ -525,17 +530,17 @@
{ {
ti_console_log("ti: external input"); ti_console_log("ti: external input");
this.Api.Begin_CompositeInput(); this.apiCompositeStart();
this.checkCompositionData(_value); this.checkCompositionData(_value);
this.Api.Replace_CompositeText(this.compositionValue); this.apiCompositeReplace(this.compositionValue);
this.Api.End_CompositeInput(); this.apiCompositeEnd();
} }
this.TextInputAfterComposition = false; this.TextInputAfterComposition = false;
if (this.isChromeKeysNoKeyPressPresent && c_oCompositionState.end == this.compositionState) if (this.isChromeKeysNoKeyPressPresent && c_oCompositionState.end == this.compositionState)
{ {
this.Api.Begin_CompositeInput(); this.apiCompositeStart();
if (this.isChromeKeysNoKeyPressPresentStartValue != "") if (this.isChromeKeysNoKeyPressPresentStartValue != "")
{ {
...@@ -544,8 +549,8 @@ ...@@ -544,8 +549,8 @@
} }
this.checkCompositionData(_value); this.checkCompositionData(_value);
this.Api.Replace_CompositeText(this.compositionValue); this.apiCompositeReplace(this.compositionValue);
this.Api.End_CompositeInput(); this.apiCompositeEnd();
} }
/* /*
...@@ -638,7 +643,7 @@ ...@@ -638,7 +643,7 @@
ti_console_log("ti: ea space"); ti_console_log("ti: ea space");
} }
if (!AscCommon.AscBrowser.isMozilla && !this.IsUseInputEventOnlyWithCtx) if (!AscCommon.AscBrowser.isMozilla/* && !this.IsUseInputEventOnlyWithCtx*/)
{ {
// у мозиллы есть проблемы, если делать тут clear // у мозиллы есть проблемы, если делать тут clear
// например на корейском языке - слетает композиция в некоторых случаях // например на корейском языке - слетает композиция в некоторых случаях
...@@ -824,10 +829,10 @@ ...@@ -824,10 +829,10 @@
if (_language == AscFonts.LanguagesFontSelectTypes.Unknown || undefined === this.Api.WordControl) if (_language == AscFonts.LanguagesFontSelectTypes.Unknown || undefined === this.Api.WordControl)
{ {
this.Api.Begin_CompositeInput(); this.apiCompositeStart();
this.checkCompositionData(_value); this.checkCompositionData(_value);
this.Api.Replace_CompositeText(this.compositionValue); this.apiCompositeReplace(this.compositionValue);
this.Api.End_CompositeInput(); this.apiCompositeEnd();
} }
else else
{ {
...@@ -862,10 +867,10 @@ ...@@ -862,10 +867,10 @@
} }
else else
{ {
this.Api.Begin_CompositeInput(); this.apiCompositeStart();
this.checkCompositionData(_value); this.checkCompositionData(_value);
this.Api.Replace_CompositeText(this.compositionValue); this.apiCompositeReplace(this.compositionValue);
this.Api.End_CompositeInput(); this.apiCompositeEnd();
} }
} }
}, },
...@@ -1073,12 +1078,45 @@ ...@@ -1073,12 +1078,45 @@
this.Api.asc_LockTargetUpdate(false); this.Api.asc_LockTargetUpdate(false);
}, },
apiCompositeStart : function()
{
if (this.compositionStateApi != c_oCompositionState.end)
return;
//console.log("[apiCompositeStart]");
this.Api.Begin_CompositeInput();
this.compositionStateApi = c_oCompositionState.process;
},
apiCompositeReplace : function(_value)
{
if (this.compositionStateApi == c_oCompositionState.end)
this.apiCompositeStart();
//console.log("[apiCompositeReplace] " + _value);
this.Api.Replace_CompositeText(_value);
this.compositionStateApi = c_oCompositionState.process;
},
apiCompositeEnd : function()
{
if (this.compositionStateApi == c_oCompositionState.end)
return;
//console.log("[apiCompositeEnd]");
this.Api.End_CompositeInput();
this.compositionStateApi = c_oCompositionState.end;
},
onCompositionStart : function(e) onCompositionStart : function(e)
{ {
if (this.DisableCompositeInput)
return;
//console.log("[START] value: " + this.getAreaValue() + ", data: " + e.data);
if (this.IsUseInputEventOnlyWithCtx) if (this.IsUseInputEventOnlyWithCtx)
{ {
if (this.compositionState == c_oCompositionState.end) this.apiCompositeStart();
this.Api.Begin_CompositeInput();
this.compositionState = c_oCompositionState.start; this.compositionState = c_oCompositionState.start;
this.msCheskComposition(e, c_oCompositionState.start); this.msCheskComposition(e, c_oCompositionState.start);
...@@ -1096,7 +1134,7 @@ ...@@ -1096,7 +1134,7 @@
ti_console_log2("begin"); ti_console_log2("begin");
if (this.compositionState == c_oCompositionState.end) if (this.compositionState == c_oCompositionState.end)
this.Api.Begin_CompositeInput(); this.apiCompositeStart();
this.compositionState = c_oCompositionState.start; this.compositionState = c_oCompositionState.start;
...@@ -1125,6 +1163,10 @@ ...@@ -1125,6 +1163,10 @@
onCompositionUpdate : function(e, isLockTarget, _data, isFromEnd) onCompositionUpdate : function(e, isLockTarget, _data, isFromEnd)
{ {
if (this.DisableCompositeInput)
return;
//console.log("[UPDATE] value: " + this.getAreaValue() + ", data: " + e.data);
if (this.IsUseInputEventOnlyWithCtx) if (this.IsUseInputEventOnlyWithCtx)
{ {
this.compositionState = c_oCompositionState.process; this.compositionState = c_oCompositionState.process;
...@@ -1219,13 +1261,11 @@ ...@@ -1219,13 +1261,11 @@
ti_console_log("ti: emulateCompositeConfirm: " + _newConfirm); ti_console_log("ti: emulateCompositeConfirm: " + _newConfirm);
this.checkCompositionData(_newConfirm); this.checkCompositionData(_newConfirm);
ti_console_log2("replace: " + this.compositionValue);
this.Api.Replace_CompositeText(this.compositionValue);
ti_console_log2("end");
this.Api.End_CompositeInput();
ti_console_log2("begin"); this.apiCompositeReplace(this.compositionValue);
this.Api.Begin_CompositeInput(); this.apiCompositeEnd();
this.apiCompositeStart();
} }
} }
} }
...@@ -1266,7 +1306,7 @@ ...@@ -1266,7 +1306,7 @@
_max = this.Api.Get_MaxCursorPosInCompositeText(); _max = this.Api.Get_MaxCursorPosInCompositeText();
} }
ti_console_log2("replace: " + this.compositionValue); ti_console_log2("replace: " + this.compositionValue);
this.Api.Replace_CompositeText(this.compositionValue); this.apiCompositeReplace(this.compositionValue);
if (_isNeedSavePos) if (_isNeedSavePos)
{ {
if (_old != _max) if (_old != _max)
...@@ -1339,6 +1379,12 @@ ...@@ -1339,6 +1379,12 @@
var _index = _value.lastIndexOf(_compositionData); var _index = _value.lastIndexOf(_compositionData);
if (-1 != _index) if (-1 != _index)
_compositionConfirm = _compositionConfirm.substr(0, _index); _compositionConfirm = _compositionConfirm.substr(0, _index);
else
{
// не может такого быть (повторяется на корейском языке, если написать - и изменить фокус).
// тогда дату мы очищаем, а e.data приходит неадекватная
_compositionData = "";
}
} }
var _offset = this.ieNonCompositionPrefixConfirm.length - _compositionConfirm.length; var _offset = this.ieNonCompositionPrefixConfirm.length - _compositionConfirm.length;
...@@ -1349,10 +1395,10 @@ ...@@ -1349,10 +1395,10 @@
var _newConfirm = this.ieNonCompositionPrefixConfirm.substr(this.ieNonCompositionPrefixConfirm.length + _offset); var _newConfirm = this.ieNonCompositionPrefixConfirm.substr(this.ieNonCompositionPrefixConfirm.length + _offset);
this.checkCompositionData(_newConfirm); this.checkCompositionData(_newConfirm);
this.Api.Replace_CompositeText(this.compositionValue); this.apiCompositeReplace(this.compositionValue);
this.Api.End_CompositeInput(); this.apiCompositeEnd();
this.Api.Begin_CompositeInput(); this.apiCompositeStart();
} }
else if (_offset > 0) else if (_offset > 0)
{ {
...@@ -1363,11 +1409,11 @@ ...@@ -1363,11 +1409,11 @@
} }
this.checkCompositionData(_compositionData); this.checkCompositionData(_compositionData);
this.Api.Replace_CompositeText(this.compositionValue); this.apiCompositeReplace(this.compositionValue);
if (type == c_oCompositionState.end) if (type == c_oCompositionState.end)
{ {
this.Api.End_CompositeInput(); this.apiCompositeEnd();
this.unlockTarget(); this.unlockTarget();
this.TextInputAfterComposition = true; this.TextInputAfterComposition = true;
...@@ -1384,6 +1430,10 @@ ...@@ -1384,6 +1430,10 @@
onCompositionEnd : function(e, _data) onCompositionEnd : function(e, _data)
{ {
if (this.DisableCompositeInput)
return;
//console.log("[END] value: " + this.getAreaValue() + ", data: " + e.data);
if (this.IsUseInputEventOnlyWithCtx) if (this.IsUseInputEventOnlyWithCtx)
{ {
this.msCheskComposition(e, c_oCompositionState.end); this.msCheskComposition(e, c_oCompositionState.end);
...@@ -1430,16 +1480,14 @@ ...@@ -1430,16 +1480,14 @@
} }
else else
{ {
this.Api.End_CompositeInput(); this.apiCompositeEnd();
} }
} }
else else
{ {
this.Api.End_CompositeInput(); this.apiCompositeEnd();
} }
this.Api.End_CompositeInput();
this.unlockTarget(); this.unlockTarget();
this.TextInputAfterComposition = true; this.TextInputAfterComposition = true;
}, },
...@@ -1488,7 +1536,7 @@ ...@@ -1488,7 +1536,7 @@
{ {
if (this.compositionState == c_oCompositionState.process) if (this.compositionState == c_oCompositionState.process)
{ {
this.Api.End_CompositeInput(); this.apiCompositeEnd();
this.clear(); this.clear();
} }
} }
......
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