Commit e1d08341 authored by Oleg.Korshul's avatar Oleg.Korshul

возможность включения новой схемы копипаста.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@68304 954022d7-b5bf-4e40-9824-e11837661b57
parent 40fb9395
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
// 5) asc_SelectionCut(); // 5) asc_SelectionCut();
/// ///
// Для инициализации вызвать g_clipboardBase.Init(api); в любой момент времени
var c_oAscClipboardDataFormat = { var c_oAscClipboardDataFormat = {
Text : 1, Text : 1,
Html : 2, Html : 2,
...@@ -410,6 +412,11 @@ CClipboardBase.prototype = ...@@ -410,6 +412,11 @@ CClipboardBase.prototype =
} }
}, },
IsWorking : function()
{
return (this.CopyFlag || this.PasteFlag) ? true : false;
},
CommonDiv_Check : function() CommonDiv_Check : function()
{ {
var ElemToSelect = document.getElementById( this.CommonDivId ); var ElemToSelect = document.getElementById( this.CommonDivId );
......
...@@ -440,40 +440,6 @@ function Editor_Copy(api, bCut) ...@@ -440,40 +440,6 @@ function Editor_Copy(api, bCut)
*/ */
} }
function Editor_CheckCopy(api, _clipboard, _formats)
{
var sBase64 = null, _data, oDocument;
//TEXT
if (c_oAscClipboardDataFormat.Text & _formats)
{
oDocument = api.WordControl.m_oLogicDocument
_data = oDocument.Get_SelectedText();
_clipboard.pushData(c_oAscClipboardDataFormat.Text, _data)
}
//HTML
if(c_oAscClipboardDataFormat.Html & _formats)
{
var oCopyProcessor = new CopyProcessor(api);
sBase64 = oCopyProcessor.Start();
_data = oCopyProcessor.getInnerHtml();
_clipboard.pushData(c_oAscClipboardDataFormat.Html, _data)
}
//INTERNAL
if(c_oAscClipboardDataFormat.Internal & _formats)
{
if(sBase64 === null)
{
var oCopyProcessor = new CopyProcessor(api);
sBase64 = oCopyProcessor.Start();
}
_data = sBase64;
_clipboard.pushData(c_oAscClipboardDataFormat.Internal, _data)
}
}
function Editor_Copy_Event(e, ElemToSelect) function Editor_Copy_Event(e, ElemToSelect)
{ {
var api = editor; var api = editor;
......
...@@ -1760,7 +1760,7 @@ function CDocMeta() ...@@ -1760,7 +1760,7 @@ function CDocMeta()
} }
} }
this.CopySelection = function(pageNum) this.CopySelection = function(pageNum, _text_format)
{ {
var ret = ""; var ret = "";
...@@ -2021,6 +2021,9 @@ function CDocMeta() ...@@ -2021,6 +2021,9 @@ function CDocMeta()
textLine += "<span>"; textLine += "<span>";
textLine += lineSpans[i].inner; textLine += lineSpans[i].inner;
textLine += "</span>"; textLine += "</span>";
if (_text_format)
_text_format.Text += lineSpans[i].inner;
} }
} }
else else
...@@ -2048,11 +2051,17 @@ function CDocMeta() ...@@ -2048,11 +2051,17 @@ function CDocMeta()
textLine += "<span>"; textLine += "<span>";
textLine += lineSpans[i].inner.substring(start, end); textLine += lineSpans[i].inner.substring(start, end);
textLine += "</span>"; textLine += "</span>";
if (_text_format)
_text_format.Text += lineSpans[i].inner.substring(start, end);
} }
} }
textLine += "</p>"; textLine += "</p>";
if (_text_format)
_text_format.Text += "\n";
ret += textLine; ret += textLine;
} }
} }
...@@ -3053,7 +3062,7 @@ function CDocMeta() ...@@ -3053,7 +3062,7 @@ function CDocMeta()
editor.WordControl.OnUpdateOverlay(); editor.WordControl.OnUpdateOverlay();
} }
this.Copy = function() this.Copy = function(_text_format)
{ {
var sel = this.Selection; var sel = this.Selection;
var page1 = sel.Page1; var page1 = sel.Page1;
...@@ -3068,7 +3077,7 @@ function CDocMeta() ...@@ -3068,7 +3077,7 @@ function CDocMeta()
var ret = "<div>"; var ret = "<div>";
for (var i = page1; i <= page2; i++) for (var i = page1; i <= page2; i++)
{ {
ret += this.CopySelection(i); ret += this.CopySelection(i, _text_format);
} }
ret += "</div>"; ret += "</div>";
......
...@@ -363,6 +363,8 @@ function asc_docs_api(name) ...@@ -363,6 +363,8 @@ function asc_docs_api(name)
} }
this.RevisionChangesStack = []; this.RevisionChangesStack = [];
//g_clipboardBase.Init(this);
} }
asc.extendClass(asc_docs_api, baseEditorsApi); asc.extendClass(asc_docs_api, baseEditorsApi);
...@@ -1816,12 +1818,89 @@ asc_docs_api.prototype.Paste = function() ...@@ -1816,12 +1818,89 @@ asc_docs_api.prototype.Paste = function()
} }
} }
}; };
asc_docs_api.prototype.Share = function(){
};
asc_docs_api.prototype.asc_CheckCopy = function(_clipboard /* CClipboardData */, _formats) asc_docs_api.prototype.asc_CheckCopy = function(_clipboard /* CClipboardData */, _formats)
{ {
Editor_CheckCopy(this, _clipboard, _formats); if (!this.WordControl.m_oLogicDocument)
{
var _text_object = (c_oAscClipboardDataFormat.Text & _formats) ? { Text : "" } : null;
var _html_data = this.WordControl.m_oDrawingDocument.m_oDocumentRenderer.Copy(_text_object);
//TEXT
if (c_oAscClipboardDataFormat.Text & _formats)
{
_clipboard.pushData(c_oAscClipboardDataFormat.Text, _text_object.Text);
}
//HTML
if(c_oAscClipboardDataFormat.Html & _formats)
{
_clipboard.pushData(c_oAscClipboardDataFormat.Html, _html_data);
}
return;
}
var sBase64 = null, _data;
//TEXT
if (c_oAscClipboardDataFormat.Text & _formats)
{
_data = this.WordControl.m_oLogicDocument.Get_SelectedText();
_clipboard.pushData(c_oAscClipboardDataFormat.Text, _data)
}
//HTML
if(c_oAscClipboardDataFormat.Html & _formats)
{
var oCopyProcessor = new CopyProcessor(this);
sBase64 = oCopyProcessor.Start();
_data = oCopyProcessor.getInnerHtml();
_clipboard.pushData(c_oAscClipboardDataFormat.Html, _data)
}
//INTERNAL
if(c_oAscClipboardDataFormat.Internal & _formats)
{
if(sBase64 === null)
{
var oCopyProcessor = new CopyProcessor(this);
sBase64 = oCopyProcessor.Start();
}
_data = sBase64;
_clipboard.pushData(c_oAscClipboardDataFormat.Internal, _data)
}
};
asc_docs_api.prototype.asc_SelectionCut = function()
{
var _logicDoc = this.WordControl.m_oLogicDocument;
if (!_logicDoc)
return;
if ( false === _logicDoc.Document_Is_SelectionLocked(changestype_Paragraph_Content) )
{
History.Create_NewPoint(historydescription_Cut);
_logicDoc.Remove(1, true, true);
_logicDoc.Document_UpdateSelectionState();
}
}; };
asc_docs_api.prototype.Share = function(){
asc_docs_api.prototype.asc_PasteData = function(_format, data1, data2)
{
switch (_format)
{
case c_oAscClipboardDataFormat.HtmlElement:
Editor_Paste_Exec(this, data1, data2);
break;
case c_oAscClipboardDataFormat.Internal:
Editor_Paste_Exec(this, null, null, data1);
break;
default:
break;
}
}; };
function OnSave_Callback(e) { function OnSave_Callback(e) {
...@@ -5491,6 +5570,15 @@ asc_docs_api.prototype.asc_enableKeyEvents = function(value){ ...@@ -5491,6 +5570,15 @@ asc_docs_api.prototype.asc_enableKeyEvents = function(value){
this.asc_fireCallback("asc_onEnableKeyEventsChanged", value); this.asc_fireCallback("asc_onEnableKeyEventsChanged", value);
} }
}; };
asc_docs_api.prototype.asc_IsFocus = function(bIsNaturalFocus)
{
var _ret = false;
if (this.WordControl.IsFocus)
_ret = true;
if (_ret && bIsNaturalFocus && this.WordControl.TextBoxInputFocus)
_ret = false;
return _ret;
};
asc_docs_api.prototype.asyncServerIdEndLoaded = function() asc_docs_api.prototype.asyncServerIdEndLoaded = function()
{ {
......
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