Commit aef49347 authored by Oleg Korshul's avatar Oleg Korshul

focus & copy/Paste

parent f4e7d018
......@@ -85,6 +85,8 @@
this.CopyPasteFocus = false;
this.CopyPasteFocusTimer = -1;
this.inputContext = null;
}
CClipboardBase.prototype =
......@@ -109,6 +111,11 @@
else
{
this.Api.asc_CheckCopy(this, AscCommon.c_oAscClipboardDataFormat.Text | AscCommon.c_oAscClipboardDataFormat.Html | AscCommon.c_oAscClipboardDataFormat.Internal);
setTimeout(function(){
g_clipboardBase.EndFocus();
}, 0);
e.preventDefault();
return false;
}
......@@ -135,6 +142,10 @@
if (!this.IsNeedDivOnCopy)
{
setTimeout(function(){
g_clipboardBase.EndFocus();
}, 0);
e.preventDefault();
return false;
}
......@@ -510,7 +521,7 @@
StartFocus : function()
{
// не плодим таймеры
this.EndFocus();
this.EndFocus(false);
this.CopyPasteFocus = true;
......@@ -523,13 +534,20 @@
},
EndFocus : function()
EndFocus : function(isFocusToEditor)
{
this.CopyPasteFocus = false;
if (-1 != this.CopyPasteFocusTimer)
{
clearTimeout(this.CopyPasteFocusTimer);
this.CopyPasteFocusTimer = -1;
if (false !== isFocusToEditor && null != this.inputContext)
{
if (this.inputContext.HtmlArea)
this.inputContext.HtmlArea.focus();
}
}
},
......
......@@ -555,6 +555,22 @@
}
return null;
}
function _getDefaultKeyboardInput(_elem, _depth)
{
var _elemTest = _elem;
for (var _level = 0; _elemTest && (_level < _depth); ++_level, _elemTest = _elemTest.parentNode)
{
var _name = " " + _elemTest.className + " ";
if (_name.indexOf(" dropdown-menu" ) > -1 ||
_name.indexOf(" dropdown-toggle ") > -1 ||
_name.indexOf(" dropdown-submenu ") > -1 ||
_name.indexOf(" canfocused ") > -1)
{
return "true";
}
}
return null;
}
window['AscCommon'] = window['AscCommon'] || {};
window['AscCommon'].CTextInput = CTextInput;
......@@ -564,6 +580,7 @@
window['AscCommon'].g_inputContext = new CTextInput(api);
window['AscCommon'].g_inputContext.init(target_id);
window['AscCommon'].g_clipboardBase.Init(api);
window['AscCommon'].g_clipboardBase.inputContext = window['AscCommon'].g_inputContext;
document.addEventListener("focus", function(e)
{
......@@ -613,6 +630,9 @@
// нужно ли прокидывать нажатие клавиш элементу (ТОЛЬКО keyDown)
var _oo_editor_keyboard = _getAttirbute(t.nativeFocusElement, "oo_editor_keyboard", 3);
if (!_oo_editor_input && !_oo_editor_keyboard)
_oo_editor_input = _getDefaultKeyboardInput(t.nativeFocusElement, 3);
if (_oo_editor_keyboard == "true")
_oo_editor_input = undefined;
......
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