Commit 6254fe3d authored by Oleg Korshul's avatar Oleg Korshul

copy/paste новая схема, новый ввод

parent 59006b72
This diff is collapsed.
......@@ -85,7 +85,7 @@
// TODO:
setInterval(function(){
if (oThis.Api.asc_IsFocus())
if (oThis.Api.asc_IsFocus() && !AscCommon.g_clipboardBase.IsFocus() && !AscCommon.g_clipboardBase.IsWorking())
oThis.HtmlArea.focus();
}, 10);
},
......@@ -318,4 +318,11 @@
window['AscCommon'] = window['AscCommon'] || {};
window['AscCommon'].CTextInput = CTextInput;
window['AscCommon'].InitBrowserInputContext = function(api, target_id)
{
window['AscCommon'].g_inputContext = new CTextInput(api);
window['AscCommon'].g_inputContext.init(target_id);
window['AscCommon'].g_clipboardBase.Init(api);
};
})(window);
......@@ -3064,6 +3064,9 @@ function CDrawingDocument()
this.m_oWordControl.CheckTextBoxInputPos();
}
if (AscCommon.g_inputContext)
AscCommon.g_inputContext.move(this.TargetHtmlElementLeft, this.TargetHtmlElementTop);
}
this.UpdateTargetTransform = function(matrix)
......
......@@ -549,9 +549,12 @@ function CEditorPage(api)
this.m_oLeftRuler_vertRuler.HtmlElement.onmouseup = this.verRulerMouseUp;//new Function("event", "verRulerMouseUp(event);");
this.m_oLeftRuler_vertRuler.HtmlElement.onmousemove = this.verRulerMouseMove;//new Function("event", "verRulerMouseMove(event);");
/*
// теперь все делает AscCommon.InitBrowserSystemContext
window.onkeydown = this.onKeyDown;//Editor_OnKeyDown;
window.onkeypress = this.onKeyPress;//Editor_OnKeyPress;
window.onkeyup = this.onKeyUp;
*/
this.m_oBody.HtmlElement.oncontextmenu = function() { return false; };
//window.oncontextmenu = function() { return false; };
......@@ -2559,7 +2562,7 @@ function CEditorPage(api)
}
this.onKeyPress = function(e)
{
if (window.GlobalPasteFlag || window.GlobalCopyFlag)
if (AscCommon.g_clipboardBase.IsWorking())
return;
if (oThis.m_oApi.isLongAction())
......@@ -3688,6 +3691,8 @@ function CEditorPage(api)
window["AutoTester"]["RunTest"]();
}
AscCommon.InitBrowserInputContext(this.m_oApi, "id_target_cursor");
//this.m_oDrawingDocument.CheckFontCache();
}
......@@ -3761,7 +3766,7 @@ function CEditorPage(api)
if (oWordControl.IsFocus && oWordControl.TextBoxInputMode && oWordControl.TextBoxInput && !AscCommon.AscBrowser.isSafariMacOs)
{
if (!oWordControl.m_oApi.isLongAction() && !window.GlobalCopyFlag)
if (!oWordControl.m_oApi.isLongAction() && !AscCommon.g_clipboardBase.IsWorking())
oWordControl.TextBoxInput.focus();
}
......@@ -3775,7 +3780,7 @@ function CEditorPage(api)
if (null != oWordControl.m_oLogicDocument && oWordControl.m_oApi.bInit_word_control)
oWordControl.m_oLogicDocument.Viewer_OnChangePosition();
}
if (null != oWordControl.m_oLogicDocument)
if (null != oWordControl.m_oLogicDocument && !oWordControl.m_oApi.isLockTargetUpdate)
{
oWordControl.m_oDrawingDocument.UpdateTargetFromPaint = true;
oWordControl.m_oLogicDocument.CheckTargetUpdate();
......
......@@ -11179,45 +11179,6 @@ CDocument.prototype.OnKeyDown = function(e)
this.Cursor_MoveDown(true === e.ShiftKey);
bRetValue = keydownresult_PreventAll;
}
else if (e.KeyCode == 45) // Insert
{
if (true === e.CtrlKey) // Ctrl + Insert (аналогично Ctrl + C)
{
Editor_Copy(this.Api);
bRetValue = keydownresult_PreventKeyPress;
}
else if (true === e.ShiftKey && false === editor.isViewMode) // Shift + Insert (аналогично Ctrl + V)
{
if (false === this.Document_Is_SelectionLocked(changestype_Paragraph_Content))
{
if (!window.GlobalPasteFlag)
{
if (!AscCommon.AscBrowser.isSafariMacOs)
{
this.Create_NewHistoryPoint(AscDFH.historydescription_Document_ShiftInsert);
window.GlobalPasteFlag = true;
editor.incrementCounterLongAction();
Editor_Paste(this.DrawingDocument.m_oWordControl.m_oApi, true);
bRetValue = keydownresult_PreventKeyPress;
}
else
{
if (0 === window.GlobalPasteFlagCounter)
{
this.Create_NewHistoryPoint(AscDFH.historydescription_Document_ShiftInsertSafari);
AscCommon.SafariIntervalFocus();
window.GlobalPasteFlag = true;
editor.incrementCounterLongAction();
Editor_Paste(this.DrawingDocument.m_oWordControl.m_oApi, true);
bRetValue = keydownresult_PreventKeyPress;
}
}
}
}
}
}
else if (e.KeyCode == 46 && false === editor.isViewMode) // Delete
{
if (true != e.ShiftKey)
......@@ -11229,14 +11190,6 @@ CDocument.prototype.OnKeyDown = function(e)
}
bRetValue = keydownresult_PreventAll;
}
else // Shift + Delete (аналогично Ctrl + X)
{
if (false === this.Document_Is_SelectionLocked(changestype_Paragraph_Content))
{
Editor_Copy(this.Api, true);
}
bRetValue = keydownresult_PreventKeyPress;
}
}
else if (e.KeyCode == 49 && false === editor.isViewMode && true === e.AltKey && !e.AltGr) // Alt + Ctrl + Num1 - применяем стиль Heading1
{
......@@ -11309,11 +11262,6 @@ CDocument.prototype.OnKeyDown = function(e)
this.Document_Format_Copy();
bRetValue = keydownresult_PreventAll;
}
else // Ctrl + C - copy
{
Editor_Copy(this.Api);
bRetValue = keydownresult_PreventKeyPress;
}
}
else if (e.KeyCode == 69 && false === editor.isViewMode && true === e.CtrlKey) // Ctrl + E + ...
{
......@@ -11432,59 +11380,6 @@ CDocument.prototype.OnKeyDown = function(e)
bRetValue = keydownresult_PreventAll;
}
}
else if (e.KeyCode == 86 && false === editor.isViewMode && true === e.CtrlKey) // Ctrl + V - paste
{
if (false === this.Document_Is_SelectionLocked(changestype_Paragraph_Content))
{
if (true === e.ShiftKey) // Ctrl + Shift + V - вставляем по образцу
{
this.Create_NewHistoryPoint(AscDFH.historydescription_Document_FormatPasteHotKey);
this.Document_Format_Paste();
bRetValue = keydownresult_PreventAll;
}
else // Ctrl + V - paste
{
if (!window.GlobalPasteFlag)
{
if (!AscCommon.AscBrowser.isSafariMacOs)
{
this.Create_NewHistoryPoint(AscDFH.historydescription_Document_PasteHotKey);
window.GlobalPasteFlag = true;
editor.incrementCounterLongAction();
Editor_Paste(this.DrawingDocument.m_oWordControl.m_oApi, true);
bRetValue = keydownresult_PreventKeyPress;
}
else
{
if (0 === window.GlobalPasteFlagCounter)
{
this.Create_NewHistoryPoint(AscDFH.historydescription_Document_PasteSafariHotKey);
AscCommon.SafariIntervalFocus();
window.GlobalPasteFlag = true;
editor.incrementCounterLongAction();
Editor_Paste(this.DrawingDocument.m_oWordControl.m_oApi, true);
bRetValue = keydownresult_PreventKeyPress;
}
}
}
else
{
if (!AscCommon.AscBrowser.isSafariMacOs)
bRetValue = keydownresult_PreventAll;
}
}
}
}
else if (e.KeyCode == 88 && false === editor.isViewMode && true === e.CtrlKey) // Ctrl + X - cut
{
if (false === this.Document_Is_SelectionLocked(changestype_Paragraph_Content))
{
Editor_Copy(this.Api, true);
}
bRetValue = keydownresult_PreventKeyPress;
}
else if (e.KeyCode == 89 && false === editor.isViewMode && true === e.CtrlKey) // Ctrl + Y - Redo
{
this.Document_Redo();
......
......@@ -814,9 +814,6 @@ background-repeat: no-repeat;\
PasteElementsId.PASTE_ELEMENT_ID = "wrd_pastebin";
PasteElementsId.ELEMENT_DISPAY_STYLE = "none";
}
if (AscCommon.AscBrowser.isSafariMacOs)
setInterval(AscCommon.SafariIntervalFocus, 10);
};
// Callbacks
/* все имена callback'оф начинаются с On. Пока сделаны:
......@@ -1882,23 +1879,10 @@ background-repeat: no-repeat;\
if (false === this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(changestype_Paragraph_Content))
{
if (!window.GlobalPasteFlag)
{
if (!AscCommon.AscBrowser.isSafariMacOs)
{
window.GlobalPasteFlag = true;
return AscCommon.Editor_Paste_Button(this);
}
else
{
if (0 === window.GlobalPasteFlagCounter)
{
AscCommon.SafariIntervalFocus();
window.GlobalPasteFlag = true;
return AscCommon.Editor_Paste_Button(this);
}
}
}
if (AscCommon.g_clipboardBase.IsWorking())
return false;
return AscCommon.g_clipboardBase.Button_Paste();
}
};
......@@ -6864,29 +6848,8 @@ background-repeat: no-repeat;\
// там при LongActions теряется фокус и вставляются пробелы
this.decrementCounterLongAction();
this.pasteCallback();
window.GlobalPasteFlag = false;
window.GlobalPasteFlagCounter = 0;
this.pasteCallback = null;
if (-1 != window.PasteEndTimerId)
{
clearTimeout(window.PasteEndTimerId);
window.PasteEndTimerId = -1;
document.body.style.MozUserSelect = "none";
document.body.style["-khtml-user-select"] = "none";
document.body.style["-o-user-select"] = "none";
document.body.style["user-select"] = "none";
document.body.style["-webkit-user-select"] = "none";
var pastebin = AscCommon.Editor_Paste_GetElem(this, true);
if (!AscCommon.AscBrowser.isSafariMacOs)
pastebin.onpaste = null;
pastebin.style.display = PasteElementsId.ELEMENT_DISPAY_STYLE;
}
return;
}
......
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