Commit f327b733 authored by Igor.Zotov's avatar Igor.Zotov

bug #17992 - Потеря части содержимого интернет страницы с картинкой при копировании и вставке

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@67464 954022d7-b5bf-4e40-9824-e11837661b57
parent 8cf62b18
......@@ -38,6 +38,9 @@
this.fontsNew = {};
this.oImages = {};
this.alreadyLoadImagesOnServer = false;
return this;
}
......@@ -2121,6 +2124,8 @@
if(isOnlyLocalBufferSafari && navigator.userAgent.toLowerCase().indexOf('safari') > -1 && navigator.userAgent.toLowerCase().indexOf('mac'))
onlyFromLocalStorage = true;
t.alreadyLoadImagesOnServer = false;
//****binary****
if(onlyFromLocalStorage)
{
......@@ -2165,16 +2170,18 @@
this.activeRange = worksheet.activeRange.clone(true);
var callBackAfterLoadImages = function()
{
History.TurnOff();
var t = this;
var oPasteProcessor;
var oTempDrawingDocument = worksheet.model.DrawingDocument;
var newCDocument = new CDocument(oTempDrawingDocument, false);
newCDocument.bFromDocument = true;
//TODo!!!!!!
newCDocument.Content[0].bFromDocument = true;
newCDocument.theme = this.Api.wbModel.theme;
newCDocument.theme = t.Api.wbModel.theme;
oTempDrawingDocument.m_oLogicDocument = newCDocument;
var oOldEditor = undefined;
......@@ -2192,6 +2199,68 @@
pasteFromBinaryWord._paste(worksheet, {content: oPasteProcessor.aContent});
window.GlobalPasteFlagCounter = 0;
window.GlobalPasteFlag = false;
};
var aImagesToDownload = this._getImageFromHtml(node, true);
if(aImagesToDownload !== null)//load to server
{
var api = asc["editor"];
sendImgUrls(api, aImagesToDownload, function (data) {
for (var i = 0, length = Math.min(data.length, aImagesToDownload.length); i < length; ++i)
{
var elem = data[i];
var sFrom = aImagesToDownload[i];
if (null != elem.url)
{
var name = g_oDocumentUrls.imagePath2Local(elem.path);
t.oImages[sFrom] = name;
}
else
{
t.oImages[sFrom] = sFrom;
}
}
t.alreadyLoadImagesOnServer = true;
callBackAfterLoadImages();
}, true);
}
else
{
callBackAfterLoadImages();
}
},
_getImageFromHtml: function(html, isGetUrlsArray)
{
var res = null;
if(html)
{
var allImages = html.getElementsByTagName('img');
if(allImages && allImages.length)
{
if(isGetUrlsArray)
{
var arrayImages = [];
for(var i = 0; i < allImages.length; i++)
{
arrayImages[i] = allImages[i].src;
}
res = arrayImages;
}
else
{
res = allImages;
}
}
}
return res;
},
_pasteResult: function(aResult, worksheet)
......
......@@ -8448,6 +8448,44 @@
{
var oObjectsForDownload = GetObjectsForImageDownload(val._aPastedImages);
//if already load images on server
if(api.wb.clipboard.alreadyLoadImagesOnServer === true)
{
var oImageMap = {};
for (var i = 0, length = oObjectsForDownload.aBuilderImagesByUrl.length; i < length; ++i)
{
var url = oObjectsForDownload.aUrls[i];
//get name from array already load on server urls
var name = api.wb.clipboard.oImages[url];
var aImageElem = oObjectsForDownload.aBuilderImagesByUrl[i];
if(name)
{
if(Array.isArray(aImageElem))
{
for(var j = 0; j < aImageElem.length; ++j)
{
var imageElem = aImageElem[j];
if (null != imageElem)
{
imageElem.SetUrl(name);
}
}
}
oImageMap[i] = name;
}
else
{
oImageMap[i] = url;
}
}
if(val.onlyImages !== true)
t._pasteFromLocalBuff(isLargeRange, isLocal, val, bIsUpdate, canChangeColWidth);
api.wb.clipboard._insertImagesFromBinaryWord(t, val, oImageMap);
}
else
{
sendImgUrls(api, oObjectsForDownload.aUrls, function (data) {
var oImageMap = {};
ResetNewUrls(data, oObjectsForDownload.aUrls, oObjectsForDownload.aBuilderImagesByUrl, oImageMap);
......@@ -8457,6 +8495,8 @@
api.wb.clipboard._insertImagesFromBinaryWord(t, val, oImageMap);
}, true);
}
}
else if(val.onlyImages !== true)
t._pasteFromLocalBuff(isLargeRange, isLocal, val, bIsUpdate, canChangeColWidth);
......
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