Commit a981c286 authored by Oleg Korshul's avatar Oleg Korshul

переделал вставку текстового поля, обработку нажатия клавиш в режиме...

переделал вставку текстового поля, обработку нажатия клавиш в режиме композитного ввода, курсор теперь может работать в двух реживах (display, visibility), второй - по умолчанию, так как иначе в фаерфоксе под виндоус - мигает подсказка переключения метода ввода)
parent cbca0ef6
......@@ -984,6 +984,9 @@
baseEditorsApi.prototype.Get_MaxCursorPosInCompositeText = function()
{
};
baseEditorsApi.prototype.Input_UpdatePos = function()
{
};
baseEditorsApi.prototype.onKeyDown = function(e)
{
......
......@@ -85,6 +85,7 @@
var oHtmlParent = oHtmlTarget.parentNode;
this.HtmlDiv = document.createElement("div");
this.HtmlDiv.id = "area_id_parent";
this.HtmlDiv.style.background = "transparent";
this.HtmlDiv.style.border = "none";
this.HtmlDiv.style.position = "absolute";
......@@ -112,7 +113,37 @@
this.HtmlDiv.appendChild(this.HtmlArea);
oHtmlParent.appendChild(this.HtmlDiv);
if (true)
{
// нужен еще один родитель. чтобы скроллился он, а не oHtmlParent
var oHtmlDivScrollable = document.createElement("div");
oHtmlDivScrollable.style.background = "transparent";
oHtmlDivScrollable.style.border = "none";
oHtmlDivScrollable.style.position = "absolute";
oHtmlDivScrollable.style.padding = "0";
oHtmlDivScrollable.style.margin = "0";
oHtmlDivScrollable.style.zIndex = 0;
oHtmlDivScrollable.style.left = oHtmlParent.style.left;
oHtmlDivScrollable.style.top = oHtmlParent.style.top;
oHtmlDivScrollable.style.width = oHtmlParent.style.width;
oHtmlDivScrollable.style.height = oHtmlParent.style.height;
oHtmlDivScrollable.style.overflow = "hidden";
oHtmlDivScrollable.appendChild(this.HtmlDiv);
oHtmlParent.parentNode.appendChild(oHtmlDivScrollable);
oHtmlParent.onresize = function(e) {
var _elem = document.getElementById("area_id_parent");
_elem.style.left = this.style.left;
_elem.style.top = this.style.top;
_elem.style.width = this.style.width;
_elem.style.height = this.style.height;
};
}
else
{
oHtmlParent.appendChild(this.HtmlDiv);
}
// events:
var oThis = this;
......@@ -132,8 +163,37 @@
// TODO:
setInterval(function(){
if (oThis.Api.asc_IsFocus() && !AscCommon.g_clipboardBase.IsFocus() && !AscCommon.g_clipboardBase.IsWorking())
{
if (document.activeElement != oThis.HtmlArea)
oThis.HtmlArea.focus();
}
}, 10);
this.Api.Input_UpdatePos();
},
checkFocus : function()
{
if (oThis.Api.asc_IsFocus() && !AscCommon.g_clipboardBase.IsFocus() && !AscCommon.g_clipboardBase.IsWorking())
{
if (document.activeElement != oThis.HtmlArea)
oThis.HtmlArea.focus();
}
},
initTimer : function()
{
/*
setInterval(function(){
oThis.checkFocus();
}, 10);
*/
var oThis = this;
setTimeout(function(){
oThis.checkFocus();
oThis.initTimer();
}, 40);
},
move : function(x, y)
......@@ -158,11 +218,13 @@
if (isShow)
{
// DEBUG_MODE
this.HtmlAreaOffset = 0;
this.HtmlArea.style.top = "0px";
this.HtmlAreaOffset = 0;
this.HtmlArea.style.top = "0px";
this.HtmlArea.style.color = "black";
this.HtmlDiv.style.zIndex = 5;
this.HtmlDiv.style.width = "200px";
//this.HtmlDiv.style.width = "200px";
document.getElementById("area_id_parent").parentNode.style.zIndex = 5;
}
},
......@@ -200,6 +262,9 @@
onKeyDown : function(e)
{
if (c_oCompositionState.end != this.compositionState)
return;
// некоторые рукописные вводы не присылают keyUp
var _code = e.keyCode;
if (_code != 8 && _code != 46)
......
......@@ -1995,6 +1995,7 @@ function CDrawingDocument()
this.NeedScrollToTargetFlag = false;
this.TargetHtmlElement = null;
this.TargetHtmlElementBlock = false; // true - block, false - visibility
this.TargetHtmlElementLeft = 0;
this.TargetHtmlElementTop = 0;
......@@ -2087,6 +2088,21 @@ function CDrawingDocument()
this._search_HdrFtr_Odd = []; // Поиск в колонтитуле, который находится только на четных страницах, включая первую
this._search_HdrFtr_Odd_no_First = []; // Поиск в колонтитуле, который находится только на нечетных страницах, кроме первой
this.showTarget = function(isShow)
{
if (this.TargetHtmlElementBlock)
this.TargetHtmlElement.style.display = isShow ? "display" : "none";
else
this.TargetHtmlElement.style.visibility = isShow ? "visible" : "hidden";
};
this.isShowTarget = function()
{
if (this.TargetHtmlElementBlock)
return (this.TargetHtmlElement.style.display == "display") ? true : false;
else
return (this.TargetHtmlElement.style.visibility == "visible") ? true : false;
};
this.Start_CollaborationEditing = function()
{
this.IsLockObjectsEnable = true;
......@@ -2942,7 +2958,8 @@ function CDrawingDocument()
clearInterval( this.m_lTimerTargetId );
this.m_lTimerTargetId = -1;
}
this.TargetHtmlElement.style.display = "none";
this.showTarget(false);
this.m_oWordControl.DisableTextEATextboxAttack();
}
......@@ -3097,6 +3114,11 @@ function CDrawingDocument()
this.m_oWordControl.CheckTextBoxInputPos();
}
this.MoveTargetInInputContext();
};
this.MoveTargetInInputContext = function()
{
if (AscCommon.g_inputContext)
AscCommon.g_inputContext.move(this.TargetHtmlElementLeft, this.TargetHtmlElementTop);
}
......@@ -3461,11 +3483,11 @@ function CDrawingDocument()
}
this.DrawTarget = function()
{
if ( "block" != oThis.TargetHtmlElement.style.display && oThis.NeedTarget && oThis.m_oWordControl.IsFocus )
oThis.TargetHtmlElement.style.display = "block";
else
oThis.TargetHtmlElement.style.display = "none";
}
if (oThis.NeedTarget && oThis.m_oWordControl.IsFocus)
{
oThis.showTarget(!oThis.isShowTarget());
}
};
this.TargetShow = function()
{
......@@ -3475,7 +3497,7 @@ function CDrawingDocument()
{
if (this.TargetShowFlag && this.TargetShowNeedFlag)
{
this.TargetHtmlElement.style.display = "block";
this.showTarget(true);
this.TargetShowNeedFlag = false;
return;
}
......@@ -3489,7 +3511,7 @@ function CDrawingDocument()
this.TargetStart();
if (oThis.NeedTarget)
this.TargetHtmlElement.style.display = "block";
this.showTarget(true);
this.TargetShowFlag = true;
}
......
......@@ -725,7 +725,7 @@ background-repeat: no-repeat;\
<div id=\"id_main_view\" class=\"block_elem\" style=\"overflow:hidden\">\
<canvas id=\"id_viewer\" class=\"block_elem\" style=\"-webkit-user-select: none; background-color:" + AscCommonWord.GlobalSkin.BackgroundColor + ";z-index:1\"></canvas>\
<canvas id=\"id_viewer_overlay\" class=\"block_elem\" style=\"-webkit-user-select: none; z-index:2\"></canvas>\
<canvas id=\"id_target_cursor\" class=\"block_elem\" width=\"1\" height=\"1\" style=\"-webkit-user-select: none;width:2px;height:13px;display:none;z-index:4;\"></canvas>\
<canvas id=\"id_target_cursor\" class=\"block_elem\" width=\"1\" height=\"1\" style=\"-webkit-user-select: none;width:2px;height:13px;z-index:4;\"></canvas>\
</div>\
</div>\
<div id=\"id_panel_right\" class=\"block_elem\" style=\"margin-right:1px;background-color:" + AscCommonWord.GlobalSkin.BackgroundScroll + ";\">\
......@@ -7941,6 +7941,11 @@ background-repeat: no-repeat;\
return this.WordControl.m_oLogicDocument.Get_MaxCursorPosInCompositeText();
return 0;
};
asc_docs_api.prototype.Input_UpdatePos = function()
{
if (this.WordControl.m_oLogicDocument)
this.WordControl.m_oDrawingDocument.MoveTargetInInputContext();
};
asc_docs_api.prototype.onKeyDown = function(e)
{
......
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