Commit bffa5ba1 authored by Sergey.Konovalov's avatar Sergey.Konovalov Committed by Alexander.Trofimov

добавлена команда imgurls для download нескольких картинок при вставке.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@49164 954022d7-b5bf-4e40-9824-e11837661b57
parent 6fe7be67
......@@ -2622,6 +2622,7 @@ PasteProcessor.prototype =
},
_Prepeare : function(node, fCallback)
{
var oThis = this;
if(true == this.bUploadImage || true == this.bUploadFonts)
{
//����������� �� ��������� �������� ������ ������� � ��������.
......@@ -2654,35 +2655,26 @@ PasteProcessor.prototype =
else if(false == (0 == src.indexOf("data:") || 0 == src.indexOf(documentOrigin + this.api.DocumentUrl) && 0 == src.indexOf(this.api.DocumentUrl)))
aImagesToDownload.push(src);
}
var oThis = this;
var nCurIndex = 0;
var fDownloadImages = function(){
if(nCurIndex < aImagesToDownload.length)
{
var src = aImagesToDownload[nCurIndex];
var rData = {"id":documentId, "c":"imgurl", "data": src};
sendCommand( oThis.api, function(incomeObject){
if(null != incomeObject && "imgurl" ==incomeObject.type)
oThis.oImages[src] = incomeObject.data;
else
oThis.oImages[src] = "error";
nCurIndex++;
fDownloadImages();
}, JSON.stringify(rData) );
}
else
{
var oPrepeareImages = new Object();
var nImagesCount = 0;
for(image in oThis.oImages)
if(aImagesToDownload.length > 0)
{
oPrepeareImages[nImagesCount] = oThis.oImages[image];
nImagesCount++;
var rData = {"id":documentId, "c":"imgurls", "data": JSON.stringify(aImagesToDownload)};
sendCommand( this.api, function(incomeObject){
if(incomeObject && "imgurls" == incomeObject.type)
{
var aImages = JSON.parse(incomeObject.data);
for(var i = 0, length1 = aImages.length, length2 = aImagesToDownload.length; i < length1 && i < length2; ++i)
{
var sNewSrc = aImages[i];
oThis.oImages[aImagesToDownload[i]] = sNewSrc
oPrepeareImages[i] = sNewSrc;
}
}
oThis.api.pre_Paste(aPrepeareFonts, oPrepeareImages, fCallback);
}, JSON.stringify(rData) );
}
};
fDownloadImages();
else
this.api.pre_Paste(aPrepeareFonts, oPrepeareImages, fCallback);
}
else
fCallback();
......
......@@ -6620,10 +6620,6 @@ function sendCommand(editor, fCallback, rdata){
case "savepart":
var outputData = JSON.parse(incomeObject.data);
_downloadAs(editor, outputData.format, fCallback, false, outputData.savekey);
break;
case "imgurl":
if(fCallback)
fCallback(incomeObject);
break;
case "getsettings":
if(fCallback)
......@@ -6634,6 +6630,10 @@ function sendCommand(editor, fCallback, rdata){
if(fCallback)
fCallback(incomeObject);
break;
default:
if(fCallback)
fCallback(incomeObject);
break;
}
}
})
......
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