Commit 6cf65f62 authored by Oleg Korshul's avatar Oleg Korshul

1) Cmd + C/X/V on macOS Sierra

2) Copy/Paste by buttons on macOS Sierra (desktop)
parent 2bceb7b7
......@@ -456,7 +456,7 @@ var editor;
spreadsheet_api.prototype.asc_Copy = function() {
if (window["AscDesktopEditor"])
{
window["AscDesktopEditor"]["Copy"]();
window["asc_desktop_copypaste"](this, "Copy");
return true;
}
return AscCommon.g_clipboardBase.Button_Copy();
......@@ -465,7 +465,7 @@ var editor;
spreadsheet_api.prototype.asc_Paste = function() {
if (window["AscDesktopEditor"])
{
window["AscDesktopEditor"]["Paste"]();
window["asc_desktop_copypaste"](this, "Paste");
return true;
}
if (!AscCommon.g_clipboardBase.IsWorking()) {
......@@ -477,7 +477,7 @@ var editor;
spreadsheet_api.prototype.asc_Cut = function() {
if (window["AscDesktopEditor"])
{
window["AscDesktopEditor"]["Cut"]();
window["asc_desktop_copypaste"](this, "Cut");
return true;
}
return AscCommon.g_clipboardBase.Button_Cut();
......
......@@ -233,6 +233,17 @@ window["asc_initAdvancedOptions"] = function(_code)
_editor._onNeedParams(undefined, (_code == 90 || _code == 91) ? true : undefined);
};
// copy/paste focus error!!!
window["asc_desktop_copypaste"] = function(_api, _method)
{
var bIsFocus = _api.asc_IsFocus();
if (!bIsFocus)
_api.asc_enableKeyEvents(true);
window["AscDesktopEditor"][_method]();
if (!bIsFocus)
_api.asc_enableKeyEvents(false);
}
// меняем среду
//AscBrowser.isSafari = false;
//AscBrowser.isSafariMacOs = false;
......
......@@ -160,6 +160,8 @@
// еще один режим для ie & edge
this.IsUseInputEventOnlyWithCtx = (AscCommon.AscBrowser.isIE) ? true : false;
this.IsInitialInputContext = false;
this.IsDisableKeyPress = false;
}
CTextInput.prototype =
......@@ -234,14 +236,32 @@
var oThis = this;
this.HtmlArea["onkeydown"] = function(e)
{
if (AscCommon.AscBrowser.isSafariMacOs)
{
var cmdButton = (e.ctrlKey || e.metaKey) ? true : false;
var buttonCode = ((e.keyCode == 67) || (e.keyCode == 88) || (e.keyCode == 86));
if (cmdButton && buttonCode)
oThis.IsDisableKeyPress = true;
else
oThis.IsDisableKeyPress = false;
}
return oThis.onKeyDown(e);
};
this.HtmlArea["onkeypress"] = function(e)
{
if (oThis.IsDisableKeyPress == true)
{
// macOS Sierra send keypress before copy event
oThis.IsDisableKeyPress = false;
var cmdButton = (e.ctrlKey || e.metaKey) ? true : false;
if (cmdButton)
return;
}
return oThis.onKeyPress(e);
};
this.HtmlArea["onkeyup"] = function(e)
{
oThis.IsDisableKeyPress = false;
return oThis.onKeyUp(e);
};
......@@ -1529,6 +1549,13 @@
this.InterfaceEnableKeyEvents = value;
if (true == this.InterfaceEnableKeyEvents)
{
if (document.activeElement)
{
var _id = document.activeElement.id;
if (_id == "area_id" || _id == "plugin_iframe")
return;
}
this.HtmlArea.focus();
}
},
......
......@@ -1824,7 +1824,7 @@ background-repeat: no-repeat;\
{
if (window["AscDesktopEditor"])
{
window["AscDesktopEditor"]["Copy"]();
window["asc_desktop_copypaste"](this, "Copy");
return true;
}
return AscCommon.g_clipboardBase.Button_Copy();
......@@ -1837,7 +1837,7 @@ background-repeat: no-repeat;\
{
if (window["AscDesktopEditor"])
{
window["AscDesktopEditor"]["Cut"]();
window["asc_desktop_copypaste"](this, "Cut");
return true;
}
return AscCommon.g_clipboardBase.Button_Cut();
......@@ -1846,7 +1846,7 @@ background-repeat: no-repeat;\
{
if (window["AscDesktopEditor"])
{
window["AscDesktopEditor"]["Paste"]();
window["asc_desktop_copypaste"](this, "Paste");
return true;
}
......
......@@ -1853,7 +1853,7 @@ background-repeat: no-repeat;\
{
if (window["AscDesktopEditor"])
{
window["AscDesktopEditor"]["Copy"]();
window["asc_desktop_copypaste"](this, "Copy");
return true;
}
return AscCommon.g_clipboardBase.Button_Copy();
......@@ -1866,7 +1866,7 @@ background-repeat: no-repeat;\
{
if (window["AscDesktopEditor"])
{
window["AscDesktopEditor"]["Cut"]();
window["asc_desktop_copypaste"](this, "Cut");
return true;
}
return AscCommon.g_clipboardBase.Button_Cut();
......@@ -1875,7 +1875,7 @@ background-repeat: no-repeat;\
{
if (window["AscDesktopEditor"])
{
window["AscDesktopEditor"]["Paste"]();
window["asc_desktop_copypaste"](this, "Paste");
return true;
}
if (!this.WordControl.m_oLogicDocument)
......
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