Commit 90d6cdda authored by Oleg Korshul's avatar Oleg Korshul

теперь все готово к встраиванию во все редакторы

parent c0e75fa0
...@@ -919,6 +919,41 @@ ...@@ -919,6 +919,41 @@
{ {
}; };
// input
baseEditorsApi.prototype.Begin_CompositeInput = function()
{
};
baseEditorsApi.prototype.Add_CompositeText = function(nCharCode)
{
};
baseEditorsApi.prototype.Remove_CompositeText = function(nCount)
{
};
baseEditorsApi.prototype.Replace_CompositeText = function(arrCharCodes)
{
};
baseEditorsApi.prototype.Set_CursorPosInCompositeText = function(nPos)
{
};
baseEditorsApi.prototype.Get_CursorPosInCompositeText = function()
{
};
baseEditorsApi.prototype.End_CompositeInput = function()
{
};
baseEditorsApi.prototype.Get_MaxCursorPosInCompositeText = function()
{
};
baseEditorsApi.prototype.onKeyDown = function(e)
{
};
baseEditorsApi.prototype.onKeyPress = function(e)
{
};
baseEditorsApi.prototype.onKeyUp = function(e)
{
};
//----------------------------------------------------------export---------------------------------------------------- //----------------------------------------------------------export----------------------------------------------------
window['AscCommon'] = window['AscCommon'] || {}; window['AscCommon'] = window['AscCommon'] || {};
......
...@@ -2,6 +2,20 @@ ...@@ -2,6 +2,20 @@
(function(window, undefined) (function(window, undefined)
{ {
///
// такие методы нужны в апи
// baseEditorsApi.prototype.Begin_CompositeInput = function()
// baseEditorsApi.prototype.Replace_CompositeText = function(arrCharCodes)
// baseEditorsApi.prototype.Set_CursorPosInCompositeText = function(nPos)
// baseEditorsApi.prototype.Get_CursorPosInCompositeText = function()
// baseEditorsApi.prototype.End_CompositeInput = function()
// baseEditorsApi.prototype.Get_MaxCursorPosInCompositeText = function()
// baseEditorsApi.prototype.onKeyDown = function(e)
// baseEditorsApi.prototype.onKeyPress = function(e)
// baseEditorsApi.prototype.onKeyUp = function(e)
///
var c_oCompositionState = { var c_oCompositionState = {
start : 0, start : 0,
process : 1, process : 1,
...@@ -20,7 +34,6 @@ ...@@ -20,7 +34,6 @@
this.HtmlAreaOffset = 60; this.HtmlAreaOffset = 60;
this.Listener = null;
this.LockerTargetTimer = -1; this.LockerTargetTimer = -1;
this.KeyDownFlag = false; this.KeyDownFlag = false;
...@@ -82,8 +95,6 @@ ...@@ -82,8 +95,6 @@
this.HtmlArea.addEventListener("compositionupdate", function(e) { return oThis.onCompositionUpdate(e); }, false); this.HtmlArea.addEventListener("compositionupdate", function(e) { return oThis.onCompositionUpdate(e); }, false);
this.HtmlArea.addEventListener("compositionend", function(e) { return oThis.onCompositionEnd(e); }, false); this.HtmlArea.addEventListener("compositionend", function(e) { return oThis.onCompositionEnd(e); }, false);
this.Listener = this.Api.WordControl.m_oLogicDocument;
this.show(false); this.show(false);
// TODO: // TODO:
...@@ -125,9 +136,6 @@ ...@@ -125,9 +136,6 @@
onInput : function(e) onInput : function(e)
{ {
if (!this.checkListener())
return;
if (AscCommon.AscBrowser.isMozilla) if (AscCommon.AscBrowser.isMozilla)
{ {
if (c_oCompositionState.process == this.compositionState) if (c_oCompositionState.process == this.compositionState)
...@@ -138,10 +146,10 @@ ...@@ -138,10 +146,10 @@
if (!this.KeyDownFlag && c_oCompositionState.end == this.compositionState && !this.TextInputAfterComposition && this.HtmlArea.value != "") if (!this.KeyDownFlag && c_oCompositionState.end == this.compositionState && !this.TextInputAfterComposition && this.HtmlArea.value != "")
{ {
this.Listener.Begin_CompositeInput(); this.Api.Begin_CompositeInput();
this.checkCompositionData(this.HtmlArea.value); this.checkCompositionData(this.HtmlArea.value);
this.Listener.Replace_CompositeText(this.compositionValue); this.Api.Replace_CompositeText(this.compositionValue);
this.Listener.End_CompositeInput(); this.Api.End_CompositeInput();
} }
this.TextInputAfterComposition = false; this.TextInputAfterComposition = false;
...@@ -165,7 +173,7 @@ ...@@ -165,7 +173,7 @@
if (_code != 8 && _code != 46) if (_code != 8 && _code != 46)
this.KeyDownFlag = true; this.KeyDownFlag = true;
return this.Api.WordControl.onKeyDown(e); return this.Api.onKeyDown(e);
}, },
onKeyPress : function(e) onKeyPress : function(e)
...@@ -173,7 +181,7 @@ ...@@ -173,7 +181,7 @@
if (c_oCompositionState.end != this.compositionState) if (c_oCompositionState.end != this.compositionState)
return; return;
return this.Api.WordControl.onKeyPress(e); return this.Api.onKeyPress(e);
}, },
onKeyUp : function(e) onKeyUp : function(e)
...@@ -181,7 +189,7 @@ ...@@ -181,7 +189,7 @@
this.KeyDownFlag = false; this.KeyDownFlag = false;
if (c_oCompositionState.end == this.compositionState) if (c_oCompositionState.end == this.compositionState)
return this.Api.WordControl.onKeyUp(e); return this.Api.onKeyUp(e);
if (AscCommon.AscBrowser.isChrome || if (AscCommon.AscBrowser.isChrome ||
AscCommon.AscBrowser.isSafari || AscCommon.AscBrowser.isSafari ||
...@@ -195,7 +203,7 @@ ...@@ -195,7 +203,7 @@
{ {
var _offset = this.HtmlArea.selectionEnd; var _offset = this.HtmlArea.selectionEnd;
_offset -= (this.HtmlArea.value.length - this.compositionValue.length); _offset -= (this.HtmlArea.value.length - this.compositionValue.length);
this.Listener.Set_CursorPosInCompositeText(_offset); this.Api.Set_CursorPosInCompositeText(_offset);
this.unlockTarget(); this.unlockTarget();
}, },
...@@ -228,11 +236,8 @@ ...@@ -228,11 +236,8 @@
onCompositionStart : function(e) onCompositionStart : function(e)
{ {
if (!this.checkListener())
return;
this.compositionState = c_oCompositionState.start; this.compositionState = c_oCompositionState.start;
this.Listener.Begin_CompositeInput(); this.Api.Begin_CompositeInput();
}, },
onCompositionUpdate : function(e, isLockTarget) onCompositionUpdate : function(e, isLockTarget)
...@@ -265,14 +270,14 @@ ...@@ -265,14 +270,14 @@
var _max = 0; var _max = 0;
if (_isNeedSavePos) if (_isNeedSavePos)
{ {
_old = this.Listener.Get_CursorPosInCompositeText(); _old = this.Api.Get_CursorPosInCompositeText();
_max = this.Listener.Get_MaxCursorPosInCompositeText(); _max = this.Api.Get_MaxCursorPosInCompositeText();
} }
this.Listener.Replace_CompositeText(this.compositionValue); this.Api.Replace_CompositeText(this.compositionValue);
if (_isNeedSavePos) if (_isNeedSavePos)
{ {
if (_old != _max) if (_old != _max)
this.Listener.Set_CursorPosInCompositeText(_old); this.Api.Set_CursorPosInCompositeText(_old);
} }
} }
...@@ -295,10 +300,10 @@ ...@@ -295,10 +300,10 @@
this.onCompositionUpdate(e, false); this.onCompositionUpdate(e, false);
} }
this.Listener.Set_CursorPosInCompositeText(1000); // max this.Api.Set_CursorPosInCompositeText(1000); // max
this.clear(); this.clear();
this.Listener.End_CompositeInput(); this.Api.End_CompositeInput();
this.unlockTarget(); this.unlockTarget();
this.TextInputAfterComposition = true; this.TextInputAfterComposition = true;
...@@ -328,13 +333,6 @@ ...@@ -328,13 +333,6 @@
} }
} }
} }
},
checkListener : function()
{
if (!this.Listener)
this.Listener = this.Api.WordControl.m_oLogicDocument;
return !!this.Listener;
} }
}; };
......
...@@ -7856,6 +7856,69 @@ background-repeat: no-repeat;\ ...@@ -7856,6 +7856,69 @@ background-repeat: no-repeat;\
return true; return true;
}; };
// input
asc_docs_api.prototype.Begin_CompositeInput = function()
{
if (this.WordControl.m_oLogicDocument)
return this.WordControl.m_oLogicDocument.Begin_CompositeInput();
return null;
};
asc_docs_api.prototype.Add_CompositeText = function(nCharCode)
{
if (this.WordControl.m_oLogicDocument)
return this.WordControl.m_oLogicDocument.Add_CompositeText(nCharCode);
return null;
};
asc_docs_api.prototype.Remove_CompositeText = function(nCount)
{
if (this.WordControl.m_oLogicDocument)
return this.WordControl.m_oLogicDocument.Remove_CompositeText(nCount);
return null;
};
asc_docs_api.prototype.Replace_CompositeText = function(arrCharCodes)
{
if (this.WordControl.m_oLogicDocument)
return this.WordControl.m_oLogicDocument.Replace_CompositeText(arrCharCodes);
return null;
};
asc_docs_api.prototype.Set_CursorPosInCompositeText = function(nPos)
{
if (this.WordControl.m_oLogicDocument)
return this.WordControl.m_oLogicDocument.Set_CursorPosInCompositeText(nPos);
return null;
};
asc_docs_api.prototype.Get_CursorPosInCompositeText = function()
{
if (this.WordControl.m_oLogicDocument)
return this.WordControl.m_oLogicDocument.Get_CursorPosInCompositeText();
return 0;
};
asc_docs_api.prototype.End_CompositeInput = function()
{
if (this.WordControl.m_oLogicDocument)
return this.WordControl.m_oLogicDocument.End_CompositeInput();
return null;
};
asc_docs_api.prototype.Get_MaxCursorPosInCompositeText = function()
{
if (this.WordControl.m_oLogicDocument)
return this.WordControl.m_oLogicDocument.Get_MaxCursorPosInCompositeText();
return 0;
};
asc_docs_api.prototype.onKeyDown = function(e)
{
return this.WordControl.onKeyDown(e);
};
asc_docs_api.prototype.onKeyPress = function(e)
{
return this.WordControl.onKeyPress(e);
};
asc_docs_api.prototype.onKeyUp = function(e)
{
return this.WordControl.onKeyUp(e);
};
window["asc_docs_api"] = asc_docs_api; window["asc_docs_api"] = asc_docs_api;
window["asc_docs_api"].prototype["asc_nativeOpenFile"] = function(base64File, version) window["asc_docs_api"].prototype["asc_nativeOpenFile"] = function(base64File, version)
{ {
......
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