Commit 232cd952 authored by alexey.musinov's avatar alexey.musinov

Merge branch 'develop' of https://github.com/ONLYOFFICE/sdkjs into develop

parents 14324502 f2b176e7
...@@ -158,7 +158,7 @@ ...@@ -158,7 +158,7 @@
} }
else else
{ {
t.pasteProcessor.editorPasteExec(ws, data1, true); t.pasteProcessor.pasteTextOnSheet(ws, data1);
} }
break; break;
...@@ -1038,7 +1038,7 @@ ...@@ -1038,7 +1038,7 @@
}, true); }, true);
}, },
editorPasteExec: function (worksheet, node, isText,onlyFromLocalStorage) editorPasteExec: function (worksheet, node, isText, onlyFromLocalStorage)
{ {
if(node == undefined) if(node == undefined)
return; return;
...@@ -1726,6 +1726,57 @@ ...@@ -1726,6 +1726,57 @@
style = ' style = "text-decoration:' + underline + ";" + "font-style:" + italic + ";" + "font-weight:" + bold + ";" + '"'; style = ' style = "text-decoration:' + underline + ";" + "font-style:" + italic + ";" + "font-weight:" + bold + ";" + '"';
$(oldElem).replaceWith("<span" + style + ">" + value + "</span>"); $(oldElem).replaceWith("<span" + style + ">" + value + "</span>");
}; };
},
pasteTextOnSheet: function(worksheet, text)
{
//TODO сделать вставку текста всегда через эту функцию
this.activeRange = worksheet.activeRange.clone(true);
//если находимся внутри шейпа
var isIntoShape = worksheet.objectRender.controller.getTargetDocContent();
if(isIntoShape)
{
var callback = function(isSuccess)
{
if(isSuccess === false)
{
return false;
}
var Count = text.length;
for ( var Index = 0; Index < Count; Index++ )
{
var _char = text.charAt(Index);
if (" " == _char)
isIntoShape.Paragraph_Add(new ParaSpace());
else
isIntoShape.Paragraph_Add(new ParaText(_char));
}
};
worksheet.objectRender.controller.checkSelectedObjectsAndCallback2(callback);
return;
}
var aResult = [];
aResult[this.activeRange.r1] = [];
var oNewItem = [];
oNewItem[0] = this._getDefaultCell(worksheet);
aResult[this.activeRange.r1][this.activeRange.c1] = oNewItem;
oNewItem[0][0].text = text;
aResult.fontsNew = [];
aResult.rowSpanSpCount = 0;
aResult.cellCount = 1;
aResult._images = undefined;
aResult._aPastedImages = undefined;
if(aResult && !(aResult.onlyImages && window["Asc"]["editor"] && window["Asc"]["editor"].isChartEditor))
{
worksheet.setSelectionInfo('paste', aResult, this);
}
} }
}; };
......
...@@ -1298,17 +1298,17 @@ CopyProcessor.prototype = ...@@ -1298,17 +1298,17 @@ CopyProcessor.prototype =
//TODO заглушка для презентационных параграфов(выделен текст внутри диаграммы) - пока не пишем в бинарник //TODO заглушка для презентационных параграфов(выделен текст внутри диаграммы) - пока не пишем в бинарник
if(selectedContent.Elements[0].Element && selectedContent.Elements[0].Element.bFromDocument === false) if(selectedContent.Elements[0].Element && selectedContent.Elements[0].Element.bFromDocument === false)
bFromPresentation = true; {
this.oBinaryFileWriter.Document = this.oDocument;
}
else
{
//подменяем Document для копирования(если не подменить, то commentId будет не соответствовать) //подменяем Document для копирования(если не подменить, то commentId будет не соответствовать)
this.oBinaryFileWriter.Document = elementsContent[0].Element.LogicDocument; this.oBinaryFileWriter.Document = elementsContent[0].Element.LogicDocument;
}
if(!bFromPresentation)
this.oBinaryFileWriter.CopyStart(); this.oBinaryFileWriter.CopyStart();
this.CopyDocument2(this.oRoot, oDocument, elementsContent, bFromPresentation); this.CopyDocument2(this.oRoot, oDocument, elementsContent, bFromPresentation);
if(!bFromPresentation)
this.oBinaryFileWriter.CopyEnd(); this.oBinaryFileWriter.CopyEnd();
} }
else else
...@@ -2129,7 +2129,7 @@ PasteProcessor.prototype = ...@@ -2129,7 +2129,7 @@ PasteProcessor.prototype =
ReadFromBinary : function(sBase64) ReadFromBinary : function(sBase64)
{ {
var openParams = { checkFileSize: false, charCount: 0, parCount: 0 }; var openParams = { checkFileSize: false, charCount: 0, parCount: 0 };
var oBinaryFileReader = new AscCommonWord.BinaryFileReader(this.oDocument, openParams); var oBinaryFileReader = new AscCommonWord.BinaryFileReader(this.oLogicDocument, openParams);
var oRes = oBinaryFileReader.ReadFromString(sBase64, true); var oRes = oBinaryFileReader.ReadFromString(sBase64, true);
this.bInBlock = oRes.bInBlock; this.bInBlock = oRes.bInBlock;
return oRes; return oRes;
...@@ -2226,8 +2226,6 @@ PasteProcessor.prototype = ...@@ -2226,8 +2226,6 @@ PasteProcessor.prototype =
} }
else if(this.oDocument.bPresentation) else if(this.oDocument.bPresentation)
{ {
base64 = null;
base64FromExcel = null;
this.pasteInPresentationShape = true; this.pasteInPresentationShape = true;
} }
...@@ -2235,6 +2233,21 @@ PasteProcessor.prototype = ...@@ -2235,6 +2233,21 @@ PasteProcessor.prototype =
if(base64 != null) if(base64 != null)
aContent = this.ReadFromBinary(base64); aContent = this.ReadFromBinary(base64);
//вставляем в заголовок диаграммы, предварительно конвертируем все параграфы в презентационный формат
if(aContent && aContent.content && this.oDocument.bPresentation && oThis.oDocument && oThis.oDocument.Parent && oThis.oDocument.Parent.parent && oThis.oDocument.Parent.parent.parent && oThis.oDocument.Parent.parent.parent.getObjectType && oThis.oDocument.Parent.parent.parent.getObjectType() == AscDFH.historyitem_type_Chart)
{
var newContent = [];
for(var i = 0; i < aContent.content.length; i++)
{
if(type_Paragraph === aContent.content[i].Get_Type())
{
newContent.push(AscFormat.ConvertParagraphToPPTX(aContent.content[i], this.oDocument.DrawingDocument, this.oDocument));
}
}
aContent.content = newContent;
}
if(base64 != null && aContent) if(base64 != null && aContent)
pasteFromBinary = true; pasteFromBinary = true;
else if(aContentExcel != null && aContent && aContent.content) else if(aContentExcel != null && aContent && aContent.content)
......
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