Fixes in onlyoffice code for image upload realtime and ooslide

pull/1/head
Ludovic Dubost 5 years ago
parent 1c19e6f2b5
commit 4cfa391a17

@ -25877,6 +25877,7 @@ function (window, undefined)
// This method calls back to the cryptpad onlyoffice inner.js to load the cryptad file dialog // This method calls back to the cryptpad onlyoffice inner.js to load the cryptad file dialog
window.parent.APP.AddImage(function(res) { window.parent.APP.AddImage(function(res) {
// This method adds the loaded image to the list of loaded images // This method adds the loaded image to the list of loaded images
console.log("AddImageCallback");
t.asc_addImageCallback(res); t.asc_addImageCallback(res);
// This method activats the image // This method activats the image
t._addImageUrl([res.url]); t._addImageUrl([res.url]);

@ -204531,6 +204531,11 @@ function DecodeBase64(imData, szSrc)
this.LoadDocumentImages = function(_images, isUrl) this.LoadDocumentImages = function(_images, isUrl)
{ {
// CryptPad added logging
console.log("Loading images");
console.log(_images);
// CryptPad end logging
// сначала заполним массив // сначала заполним массив
if (this.ThemeLoader == null) if (this.ThemeLoader == null)
this.Api.asyncImagesDocumentStartLoaded(); this.Api.asyncImagesDocumentStartLoaded();
@ -204694,16 +204699,18 @@ function DecodeBase64(imData, szSrc)
oThat.Api.asyncImageEndLoadedBackground(oImage); oThat.Api.asyncImageEndLoadedBackground(oImage);
}; };
//oImage.Image.crossOrigin = 'anonymous'; //oImage.Image.crossOrigin = 'anonymous';
console.log("Loading image " + i);
console.log(oImage);
// CRYPTPAD: if we find an image URL with #channel= in it // CRYPTPAD: if we find an image URL with #channel= in it
// then we need to ask cryptpad to get the blob // then we need to ask cryptpad to get the blob
if (oImage.src.indexOf("#src=")!=-1) if (oImage.src.indexOf("#src=")!=-1) {
window.parent.APP.getImageURL(oImage.src, function(url) { window.parent.APP.getImageURL(oImage.src, function(url) {
oThis.loadImageByUrl(oImage.Image, url); oThis.loadImageByUrl(oImage.Image, url);
oThis.map_image_index[url] = oImage; oThis.map_image_index[url] = oImage;
}); });
else } else {
oThis.loadImageByUrl(oImage.Image, oImage.src); oThis.loadImageByUrl(oImage.Image, oImage.src);
}
}; };
this.LoadImagesWithCallback = function(arr, loadImageCallBack, loadImageCallBackArgs) this.LoadImagesWithCallback = function(arr, loadImageCallBack, loadImageCallBackArgs)
@ -205226,6 +205233,11 @@ CCollaborativeEditingBase.prototype.SendImagesUrlsFromChanges = function (aImage
if(false === oApi.isSaveFonts_Images){ if(false === oApi.isSaveFonts_Images){
oApi.isSaveFonts_Images = true; oApi.isSaveFonts_Images = true;
} }
// CryptPad - bypassing image loading which is breaking
AscCommon.CollaborativeEditing.SendImagesCallback(aImagesToLoad);
/*
oApi.fCurCallback = function (oRes) { oApi.fCurCallback = function (oRes) {
var aData, i, oUrls; var aData, i, oUrls;
if(oRes['status'] === 'ok') if(oRes['status'] === 'ok')
@ -205241,6 +205253,7 @@ CCollaborativeEditingBase.prototype.SendImagesUrlsFromChanges = function (aImage
AscCommon.CollaborativeEditing.SendImagesCallback(aImagesToLoad); AscCommon.CollaborativeEditing.SendImagesCallback(aImagesToLoad);
}; };
AscCommon.sendCommand(oApi, null, rData); AscCommon.sendCommand(oApi, null, rData);
*/
}; };
CCollaborativeEditingBase.prototype.SendImagesCallback = function (aImages) { CCollaborativeEditingBase.prototype.SendImagesCallback = function (aImages) {
@ -205454,15 +205467,16 @@ CCollaborativeEditingBase.prototype.Clear_NewImages = function()
}; };
CCollaborativeEditingBase.prototype.Add_NewImage = function(Url) CCollaborativeEditingBase.prototype.Add_NewImage = function(Url)
{ {
this.m_aNewImages.push( Url );
// CryptPad - Modify URL for local loading // CryptPad - Modify URL for local loading
var that = this; /*
console.log("Add Image " + Url);
if (Url.indexOf("#src=")!=-1) { if (Url.indexOf("#src=")!=-1) {
window.parent.APP.getImageURL(Url, function(url) { window.parent.APP.getImageURL(Url, function(url) {
that.m_aNewImages.push( Url ); console.log("CryptPad Image " + url);
}); });
} else {
this.m_aNewImages.push( Url );
} }
*/ 
// CryptPad - End modification // CryptPad - End modification
}; };
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------

@ -21175,6 +21175,11 @@ CCollaborativeEditingBase.prototype.SendImagesUrlsFromChanges = function (aImage
if(false === oApi.isSaveFonts_Images){ if(false === oApi.isSaveFonts_Images){
oApi.isSaveFonts_Images = true; oApi.isSaveFonts_Images = true;
} }
// CryptPad - bypassing image loading which is breaking
AscCommon.CollaborativeEditing.SendImagesCallback(aImagesToLoad);
/*
oApi.fCurCallback = function (oRes) { oApi.fCurCallback = function (oRes) {
var aData, i, oUrls; var aData, i, oUrls;
if(oRes['status'] === 'ok') if(oRes['status'] === 'ok')
@ -21190,6 +21195,7 @@ CCollaborativeEditingBase.prototype.SendImagesUrlsFromChanges = function (aImage
AscCommon.CollaborativeEditing.SendImagesCallback(aImagesToLoad); AscCommon.CollaborativeEditing.SendImagesCallback(aImagesToLoad);
}; };
AscCommon.sendCommand(oApi, null, rData); AscCommon.sendCommand(oApi, null, rData);
*/
}; };
CCollaborativeEditingBase.prototype.SendImagesCallback = function (aImages) { CCollaborativeEditingBase.prototype.SendImagesCallback = function (aImages) {
@ -21403,15 +21409,16 @@ CCollaborativeEditingBase.prototype.Clear_NewImages = function()
}; };
CCollaborativeEditingBase.prototype.Add_NewImage = function(Url) CCollaborativeEditingBase.prototype.Add_NewImage = function(Url)
{ {
this.m_aNewImages.push( Url );
// CryptPad - Modify URL for local loading // CryptPad - Modify URL for local loading
var that = this; /*
console.log("Add Image " + Url);
if (Url.indexOf("#src=")!=-1) { if (Url.indexOf("#src=")!=-1) {
window.parent.APP.getImageURL(Url, function(url) { window.parent.APP.getImageURL(Url, function(url) {
that.m_aNewImages.push( Url ); console.log("CryptPad Image " + url);
}); });
} else {
this.m_aNewImages.push( Url );
} }
*/ 
// CryptPad - End modification // CryptPad - End modification
}; };
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
@ -24334,6 +24341,7 @@ function (window, undefined)
// This method calls back to the cryptpad onlyoffice inner.js to load the cryptad file dialog // This method calls back to the cryptpad onlyoffice inner.js to load the cryptad file dialog
window.parent.APP.AddImage(function(res) { window.parent.APP.AddImage(function(res) {
// This method adds the loaded image to the list of loaded images // This method adds the loaded image to the list of loaded images
console.log("AddImageCallback");
t.asc_addImageCallback(res); t.asc_addImageCallback(res);
// This method activats the image // This method activats the image
t._addImageUrl([res.url]); t._addImageUrl([res.url]);

@ -205879,6 +205879,11 @@ function DecodeBase64(imData, szSrc)
this.LoadDocumentImages = function(_images, isUrl) this.LoadDocumentImages = function(_images, isUrl)
{ {
// CryptPad added logging
console.log("Loading images");
console.log(_images);
// CryptPad end logging
// сначала заполним массив // сначала заполним массив
if (this.ThemeLoader == null) if (this.ThemeLoader == null)
this.Api.asyncImagesDocumentStartLoaded(); this.Api.asyncImagesDocumentStartLoaded();
@ -206042,16 +206047,18 @@ function DecodeBase64(imData, szSrc)
oThat.Api.asyncImageEndLoadedBackground(oImage); oThat.Api.asyncImageEndLoadedBackground(oImage);
}; };
//oImage.Image.crossOrigin = 'anonymous'; //oImage.Image.crossOrigin = 'anonymous';
console.log("Loading image " + i);
console.log(oImage);
// CRYPTPAD: if we find an image URL with #channel= in it // CRYPTPAD: if we find an image URL with #channel= in it
// then we need to ask cryptpad to get the blob // then we need to ask cryptpad to get the blob
if (oImage.src.indexOf("#src=")!=-1) if (oImage.src.indexOf("#src=")!=-1) {
window.parent.APP.getImageURL(oImage.src, function(url) { window.parent.APP.getImageURL(oImage.src, function(url) {
oThis.loadImageByUrl(oImage.Image, url); oThis.loadImageByUrl(oImage.Image, url);
oThis.map_image_index[url] = oImage; oThis.map_image_index[url] = oImage;
}); });
else } else {
oThis.loadImageByUrl(oImage.Image, oImage.src); oThis.loadImageByUrl(oImage.Image, oImage.src);
}
}; };
this.LoadImagesWithCallback = function(arr, loadImageCallBack, loadImageCallBackArgs) this.LoadImagesWithCallback = function(arr, loadImageCallBack, loadImageCallBackArgs)

@ -21308,6 +21308,11 @@ CCollaborativeEditingBase.prototype.SendImagesUrlsFromChanges = function (aImage
if(false === oApi.isSaveFonts_Images){ if(false === oApi.isSaveFonts_Images){
oApi.isSaveFonts_Images = true; oApi.isSaveFonts_Images = true;
} }
// CryptPad - bypassing image loading which is breaking
AscCommon.CollaborativeEditing.SendImagesCallback(aImagesToLoad);
/*
oApi.fCurCallback = function (oRes) { oApi.fCurCallback = function (oRes) {
var aData, i, oUrls; var aData, i, oUrls;
if(oRes['status'] === 'ok') if(oRes['status'] === 'ok')
@ -21323,6 +21328,7 @@ CCollaborativeEditingBase.prototype.SendImagesUrlsFromChanges = function (aImage
AscCommon.CollaborativeEditing.SendImagesCallback(aImagesToLoad); AscCommon.CollaborativeEditing.SendImagesCallback(aImagesToLoad);
}; };
AscCommon.sendCommand(oApi, null, rData); AscCommon.sendCommand(oApi, null, rData);
*/
}; };
CCollaborativeEditingBase.prototype.SendImagesCallback = function (aImages) { CCollaborativeEditingBase.prototype.SendImagesCallback = function (aImages) {
@ -21536,15 +21542,16 @@ CCollaborativeEditingBase.prototype.Clear_NewImages = function()
}; };
CCollaborativeEditingBase.prototype.Add_NewImage = function(Url) CCollaborativeEditingBase.prototype.Add_NewImage = function(Url)
{ {
this.m_aNewImages.push( Url );
// CryptPad - Modify URL for local loading // CryptPad - Modify URL for local loading
var that = this; /*
console.log("Add Image " + Url);
if (Url.indexOf("#src=")!=-1) { if (Url.indexOf("#src=")!=-1) {
window.parent.APP.getImageURL(Url, function(url) { window.parent.APP.getImageURL(Url, function(url) {
that.m_aNewImages.push( Url ); console.log("CryptPad Image " + url);
}); });
} else {
this.m_aNewImages.push( Url );
} }
*/ 
// CryptPad - End modification // CryptPad - End modification
}; };
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
@ -24352,6 +24359,7 @@ function (window, undefined)
// This method calls back to the cryptpad onlyoffice inner.js to load the cryptad file dialog // This method calls back to the cryptpad onlyoffice inner.js to load the cryptad file dialog
window.parent.APP.AddImage(function(res) { window.parent.APP.AddImage(function(res) {
// This method adds the loaded image to the list of loaded images // This method adds the loaded image to the list of loaded images
console.log("AddImageCallback");
t.asc_addImageCallback(res); t.asc_addImageCallback(res);
// This method activats the image // This method activats the image
t._addImageUrl([res.url]); t._addImageUrl([res.url]);

@ -205034,6 +205034,11 @@ function DecodeBase64(imData, szSrc)
this.LoadDocumentImages = function(_images, isUrl) this.LoadDocumentImages = function(_images, isUrl)
{ {
// CryptPad added logging
console.log("Loading images");
console.log(_images);
// CryptPad end logging
// сначала заполним массив // сначала заполним массив
if (this.ThemeLoader == null) if (this.ThemeLoader == null)
this.Api.asyncImagesDocumentStartLoaded(); this.Api.asyncImagesDocumentStartLoaded();
@ -205197,16 +205202,18 @@ function DecodeBase64(imData, szSrc)
oThat.Api.asyncImageEndLoadedBackground(oImage); oThat.Api.asyncImageEndLoadedBackground(oImage);
}; };
//oImage.Image.crossOrigin = 'anonymous'; //oImage.Image.crossOrigin = 'anonymous';
console.log("Loading image " + i);
console.log(oImage);
// CRYPTPAD: if we find an image URL with #channel= in it // CRYPTPAD: if we find an image URL with #channel= in it
// then we need to ask cryptpad to get the blob // then we need to ask cryptpad to get the blob
if (oImage.src.indexOf("#src=")!=-1) if (oImage.src.indexOf("#src=")!=-1) {
window.parent.APP.getImageURL(oImage.src, function(url) { window.parent.APP.getImageURL(oImage.src, function(url) {
oThis.loadImageByUrl(oImage.Image, url); oThis.loadImageByUrl(oImage.Image, url);
oThis.map_image_index[url] = oImage; oThis.map_image_index[url] = oImage;
}); });
else } else {
oThis.loadImageByUrl(oImage.Image, oImage.src); oThis.loadImageByUrl(oImage.Image, oImage.src);
}
}; };
this.LoadImagesWithCallback = function(arr, loadImageCallBack, loadImageCallBackArgs) this.LoadImagesWithCallback = function(arr, loadImageCallBack, loadImageCallBackArgs)

Loading…
Cancel
Save