Commit 5d030a42 authored by Oleg Korshul's avatar Oleg Korshul

Header/Footer selection bugs, Copy/Paste on button

parent 8d20fff7
......@@ -87,6 +87,7 @@
this.CopyPasteFocusTimer = -1;
this.inputContext = null;
this.LastCopyBinary = null; // для вставки по кнопке, еогда браузер не позволяет
}
CClipboardBase.prototype =
......@@ -110,6 +111,7 @@
}
else
{
this.LastCopyBinary = null;
this.Api.asc_CheckCopy(this, AscCommon.c_oAscClipboardDataFormat.Text | AscCommon.c_oAscClipboardDataFormat.Html | AscCommon.c_oAscClipboardDataFormat.Internal);
setTimeout(function(){
......@@ -135,6 +137,7 @@
}
else
{
this.LastCopyBinary = null;
this.Api.asc_CheckCopy(this, AscCommon.c_oAscClipboardDataFormat.Text | AscCommon.c_oAscClipboardDataFormat.Html | AscCommon.c_oAscClipboardDataFormat.Internal);
}
......@@ -505,7 +508,6 @@
setInterval(function()
{
if (g_clipboardBase.Api.asc_IsFocus(true))
g_clipboardBase.CommonDiv.focus();
......@@ -680,7 +682,8 @@
this.CommonDiv_Start();
this.ClosureParams.isDivCopy = true;
this.Api.asc_CheckCopy(this, AscCommon.c_oAscClipboardDataFormat.Html);
this.LastCopyBinary = null;
this.Api.asc_CheckCopy(this, AscCommon.c_oAscClipboardDataFormat.Text | AscCommon.c_oAscClipboardDataFormat.Html | AscCommon.c_oAscClipboardDataFormat.Internal);
this.ClosureParams.isDivCopy = false;
this.CommonDiv_Select();
......@@ -762,6 +765,10 @@
pushData : function(_format, _data)
{
if (null == this.LastCopyBinary)
this.LastCopyBinary = [];
this.LastCopyBinary.push({ type: _format, data : _data });
if (this.ClosureParams.isDivCopy === true)
{
if (_format == AscCommon.c_oAscClipboardDataFormat.Html)
......@@ -796,19 +803,59 @@
Button_Copy : function()
{
if (this.inputContext)
this.inputContext.HtmlArea.focus();
this.Api.asc_enableKeyEvents(true, true);
this.CommonDiv_Execute_CopyCut();
return document.execCommand("copy");
var _ret = document.execCommand("copy");
if (!_ret)
{
// копирования не было
this.LastCopyBinary = null;
this.Api.asc_CheckCopy(this, AscCommon.c_oAscClipboardDataFormat.Text | AscCommon.c_oAscClipboardDataFormat.Html | AscCommon.c_oAscClipboardDataFormat.Internal);
}
return _ret;
},
Button_Cut : function()
{
if (this.inputContext)
this.inputContext.HtmlArea.focus();
this.Api.asc_enableKeyEvents(true, true);
this.CommonDiv_Execute_CopyCut();
return document.execCommand("cut");
var _ret = document.execCommand("cut");
if (!_ret)
{
// копирования не было
this.LastCopyBinary = null;
this.Api.asc_CheckCopy(this, AscCommon.c_oAscClipboardDataFormat.Text | AscCommon.c_oAscClipboardDataFormat.Html | AscCommon.c_oAscClipboardDataFormat.Internal);
this.Api.asc_SelectionCut();
}
return _ret;
},
Button_Paste : function()
{
return document.execCommand("paste");
if (this.inputContext)
this.inputContext.HtmlArea.focus();
this.Api.asc_enableKeyEvents(true, true);
var _ret = document.execCommand("paste");
if (!_ret && null != this.LastCopyBinary)
{
var _data = null;
for (var i = 0; i < this.LastCopyBinary.length; i++)
{
if (c_oAscClipboardDataFormat.Internal == this.LastCopyBinary[i].type)
{
this.Api.asc_PasteData(AscCommon.c_oAscClipboardDataFormat.Internal, this.LastCopyBinary[i].data);
}
}
}
return _ret;
}
};
......
......@@ -82,8 +82,8 @@ CHdrFtrController.prototype.Remove = function(Count, bOnlyText, bRemoveOnlySelec
if (null !== this.HdrFtr.CurHdtr && docpostype_DrawingObjects !== this.HdrFtr.CurHdrFtr.Content.CurPos.Type)
{
this.Selection_Remove();
this.Selection.Use = false;
this.LogicDocument.Selection_Remove();
this.LogicDocument.Selection.Use = false;
}
return nResult;
......
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