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 @@
}
else
{
t.pasteProcessor.editorPasteExec(ws, data1, true);
t.pasteProcessor.pasteTextOnSheet(ws, data1);
}
break;
......@@ -1038,7 +1038,7 @@
}, true);
},
editorPasteExec: function (worksheet, node, isText,onlyFromLocalStorage)
editorPasteExec: function (worksheet, node, isText, onlyFromLocalStorage)
{
if(node == undefined)
return;
......@@ -1726,6 +1726,57 @@
style = ' style = "text-decoration:' + underline + ";" + "font-style:" + italic + ";" + "font-weight:" + bold + ";" + '"';
$(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,18 +1298,18 @@ CopyProcessor.prototype =
//TODO заглушка для презентационных параграфов(выделен текст внутри диаграммы) - пока не пишем в бинарник
if(selectedContent.Elements[0].Element && selectedContent.Elements[0].Element.bFromDocument === false)
bFromPresentation = true;
//подменяем Document для копирования(если не подменить, то commentId будет не соответствовать)
this.oBinaryFileWriter.Document = elementsContent[0].Element.LogicDocument;
if(!bFromPresentation)
this.oBinaryFileWriter.CopyStart();
{
this.oBinaryFileWriter.Document = this.oDocument;
}
else
{
//подменяем Document для копирования(если не подменить, то commentId будет не соответствовать)
this.oBinaryFileWriter.Document = elementsContent[0].Element.LogicDocument;
}
this.oBinaryFileWriter.CopyStart();
this.CopyDocument2(this.oRoot, oDocument, elementsContent, bFromPresentation);
if(!bFromPresentation)
this.oBinaryFileWriter.CopyEnd();
this.oBinaryFileWriter.CopyEnd();
}
else
{
......@@ -2129,7 +2129,7 @@ PasteProcessor.prototype =
ReadFromBinary : function(sBase64)
{
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);
this.bInBlock = oRes.bInBlock;
return oRes;
......@@ -2226,15 +2226,28 @@ PasteProcessor.prototype =
}
else if(this.oDocument.bPresentation)
{
base64 = null;
base64FromExcel = null;
this.pasteInPresentationShape = true;
}
var isImageInNode = node && node.getElementsByTagName('img') && node.getElementsByTagName('img').length ? true : false;
if(base64 != null)
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)
pasteFromBinary = true;
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