Fixes for image support
This commit is contained in:
parent
6155284c4d
commit
d9fb248504
@ -227,11 +227,11 @@ define([
|
|||||||
// loadable by users joining after the checkpoint
|
// loadable by users joining after the checkpoint
|
||||||
var fixSheets = function () {
|
var fixSheets = function () {
|
||||||
try {
|
try {
|
||||||
|
var editor = window.frames[0].editor;
|
||||||
// if we are not in the sheet app
|
// if we are not in the sheet app
|
||||||
// we should not call this code
|
// we should not call this code
|
||||||
if (!editor.GetSheets)
|
if (typeof editor.GetSheets === 'undefined')
|
||||||
return;
|
return;
|
||||||
var editor = window.frames[0].editor;
|
|
||||||
var s = editor.GetSheets();
|
var s = editor.GetSheets();
|
||||||
if (s.length === 0) { return; }
|
if (s.length === 0) { return; }
|
||||||
var wb = s[0].worksheet.workbook;
|
var wb = s[0].worksheet.workbook;
|
||||||
@ -735,15 +735,15 @@ define([
|
|||||||
FileCrypto.decrypt(u8, Nacl.util.decodeBase64(data.key), function (err, res) {
|
FileCrypto.decrypt(u8, Nacl.util.decodeBase64(data.key), function (err, res) {
|
||||||
if (err || !res.content) { console.log("cryptpad decode fail"); return APP.AddImageErrorCallback(err); }
|
if (err || !res.content) { console.log("cryptpad decode fail"); return APP.AddImageErrorCallback(err); }
|
||||||
var url = URL.createObjectURL(res.content);
|
var url = URL.createObjectURL(res.content);
|
||||||
var name = data.name + "#src=" + data.src + ",key=" + data.key + ",name=" + data.name;
|
var hiddendata = "#src=" + encodeURIComponent(data.src) + ",key=" + encodeURIComponent(data.key) + ",name=" + encodeURIComponent(data.name);
|
||||||
|
var name = data.name + hiddendata;
|
||||||
console.log("CRYPTPAD success add " + name);
|
console.log("CRYPTPAD success add " + name);
|
||||||
APP.AddImageSuccessCallback({
|
APP.AddImageSuccessCallback({
|
||||||
name: name,
|
name: name,
|
||||||
metadata: res.metadata,
|
metadata: res.metadata,
|
||||||
content: res.content,
|
content: res.content,
|
||||||
url: url
|
url: url + hiddendata
|
||||||
});
|
});
|
||||||
makeCheckpoint();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -760,16 +760,18 @@ define([
|
|||||||
|
|
||||||
APP.getImageURL = function(name, callback) {
|
APP.getImageURL = function(name, callback) {
|
||||||
var data = {};
|
var data = {};
|
||||||
var params = name.substring(name.lastIndexOf("#") + 1).split(",");
|
var hiddendata = name.substring(name.lastIndexOf("#") + 1);
|
||||||
|
var params = hiddendata.split(",");
|
||||||
|
|
||||||
for (var i in params) {
|
for (var i in params) {
|
||||||
var item = params[i].split("=");
|
var item = params[i].split("=");
|
||||||
data[item[0]] = item[1];
|
data[item[0]] = decodeURIComponent(item[1]);
|
||||||
}
|
}
|
||||||
Util.fetch(data.src, function (err, u8) {
|
Util.fetch(data.src, function (err, u8) {
|
||||||
FileCrypto.decrypt(u8, Nacl.util.decodeBase64(data.key), function (err, res) {
|
FileCrypto.decrypt(u8, Nacl.util.decodeBase64(data.key), function (err, res) {
|
||||||
if (err || !res.content) { return APP.AddImageErrorCallback(err); }
|
if (err || !res.content) { return APP.AddImageErrorCallback(err); }
|
||||||
var url = URL.createObjectURL(res.content);
|
var url = URL.createObjectURL(res.content) + "#" + hiddendata;
|
||||||
|
window.frames[0].AscCommon.g_oDocumentUrls.addImageUrl(data.name + "#" + hiddendata, url);
|
||||||
callback(url);
|
callback(url);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
44
www/common/onlyoffice/sdkjs/cell/sdk-all-min.js
vendored
44
www/common/onlyoffice/sdkjs/cell/sdk-all-min.js
vendored
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) Ascensio System SIA 2012-2019. All rights reserved
|
* Copyright (C) Ascensio System SIA 2012-2020. All rights reserved
|
||||||
*
|
*
|
||||||
* https://www.onlyoffice.com/
|
* https://www.onlyoffice.com/
|
||||||
*
|
*
|
||||||
@ -11208,7 +11208,7 @@ function isRealObject(obj)
|
|||||||
if (window['IS_NATIVE_EDITOR'])
|
if (window['IS_NATIVE_EDITOR'])
|
||||||
{
|
{
|
||||||
var stream = window["native"]["openFileCommand"](sFileUrl, changesUrl, Signature);
|
var stream = window["native"]["openFileCommand"](sFileUrl, changesUrl, Signature);
|
||||||
|
|
||||||
//получаем url к папке с файлом
|
//получаем url к папке с файлом
|
||||||
var url;
|
var url;
|
||||||
var nIndex = sFileUrl.lastIndexOf("/");
|
var nIndex = sFileUrl.lastIndexOf("/");
|
||||||
@ -11220,7 +11220,7 @@ function isRealObject(obj)
|
|||||||
} else {
|
} else {
|
||||||
bError = true;
|
bError = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bEndLoadFile = true;
|
bEndLoadFile = true;
|
||||||
onEndOpen();
|
onEndOpen();
|
||||||
}
|
}
|
||||||
@ -12108,6 +12108,10 @@ function isRealObject(obj)
|
|||||||
|
|
||||||
function UploadImageFiles(files, documentId, documentUserId, jwt, callback)
|
function UploadImageFiles(files, documentId, documentUserId, jwt, callback)
|
||||||
{
|
{
|
||||||
|
// CryptPad: we need to take control of the upload
|
||||||
|
window.parent.APP.UploadImageFiles(files, documentId, documentUserId, jwt, callback);
|
||||||
|
return;
|
||||||
|
|
||||||
if (files.length > 0)
|
if (files.length > 0)
|
||||||
{
|
{
|
||||||
var url = sUploadServiceLocalUrl + '/' + documentId + '/' + documentUserId + '/' + g_oDocumentUrls.getMaxIndex();
|
var url = sUploadServiceLocalUrl + '/' + documentId + '/' + documentUserId + '/' + g_oDocumentUrls.getMaxIndex();
|
||||||
@ -15318,6 +15322,7 @@ window["AscDesktopEditor_Save"] = function()
|
|||||||
window["AscDesktopEditor"]["OnSave"]();
|
window["AscDesktopEditor"]["OnSave"]();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (c) Copyright Ascensio System SIA 2010-2018
|
* (c) Copyright Ascensio System SIA 2010-2018
|
||||||
*
|
*
|
||||||
@ -25857,9 +25862,32 @@ function (window, undefined)
|
|||||||
baseEditorsApi.prototype._addImageUrl = function()
|
baseEditorsApi.prototype._addImageUrl = function()
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
// CRYPTPAD
|
||||||
|
// This method is necessary to add the loaded images to the list of loaded images
|
||||||
|
// The code is in slide/api.js
|
||||||
|
baseEditorsApi.prototype.asc_addImageCallback = function(res)
|
||||||
|
{
|
||||||
|
};
|
||||||
baseEditorsApi.prototype.asc_addImage = function()
|
baseEditorsApi.prototype.asc_addImage = function()
|
||||||
{
|
{
|
||||||
var t = this;
|
var t = this;
|
||||||
|
|
||||||
|
// CryptPad: we need to take control of the upload
|
||||||
|
// t.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage);
|
||||||
|
// This method calls back to the cryptpad onlyoffice inner.js to load the cryptad file dialog
|
||||||
|
window.parent.APP.AddImage(function(res) {
|
||||||
|
// This method adds the loaded image to the list of loaded images
|
||||||
|
t.asc_addImageCallback(res);
|
||||||
|
// This method activats the image
|
||||||
|
t._addImageUrl([res.url]);
|
||||||
|
// t.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage);
|
||||||
|
}, function() {
|
||||||
|
// t.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage);
|
||||||
|
t.sendEvent("asc_onError", error, c_oAscError.Level.NoCritical);
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
// Cryptpad end
|
||||||
|
|
||||||
AscCommon.ShowImageFileDialog(this.documentId, this.documentUserId, this.CoAuthoringApi.get_jwt(), function(error, files)
|
AscCommon.ShowImageFileDialog(this.documentId, this.documentUserId, this.CoAuthoringApi.get_jwt(), function(error, files)
|
||||||
{
|
{
|
||||||
t._uploadCallback(error, files);
|
t._uploadCallback(error, files);
|
||||||
@ -31199,6 +31227,16 @@ var editor;
|
|||||||
// ToDo заменить на общую функцию для всех
|
// ToDo заменить на общую функцию для всех
|
||||||
this.asc_addImage();
|
this.asc_addImage();
|
||||||
};
|
};
|
||||||
|
// CRYPTPAD
|
||||||
|
// This method is necessary to add the loaded images to the list of loaded images
|
||||||
|
spreadsheet_api.prototype.asc_addImageCallback = function(res)
|
||||||
|
{
|
||||||
|
g_oDocumentUrls.addImageUrl(res.name, res.url)
|
||||||
|
};
|
||||||
|
spreadsheet_api.prototype.asyncImageEndLoadedBackground = function(_image)
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
spreadsheet_api.prototype._addImageUrl = function(urls) {
|
spreadsheet_api.prototype._addImageUrl = function(urls) {
|
||||||
var ws = this.wb.getWorksheet();
|
var ws = this.wb.getWorksheet();
|
||||||
if (ws) {
|
if (ws) {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) Ascensio System SIA 2012-2019. All rights reserved
|
* Copyright (C) Ascensio System SIA 2012-2020. All rights reserved
|
||||||
*
|
*
|
||||||
* https://www.onlyoffice.com/
|
* https://www.onlyoffice.com/
|
||||||
*
|
*
|
||||||
@ -204103,7 +204103,7 @@ function DecodeBase64(imData, szSrc)
|
|||||||
{
|
{
|
||||||
this.Api = _api;
|
this.Api = _api;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.LoadEmbeddedFonts = function(url, _fonts)
|
this.LoadEmbeddedFonts = function(url, _fonts)
|
||||||
{
|
{
|
||||||
this.embeddedFilesPath = url;
|
this.embeddedFilesPath = url;
|
||||||
@ -204372,7 +204372,7 @@ function DecodeBase64(imData, szSrc)
|
|||||||
oThis.Api.OpenDocumentProgress.CurrentFont++;
|
oThis.Api.OpenDocumentProgress.CurrentFont++;
|
||||||
oThis.Api.SendOpenProgress();
|
oThis.Api.SendOpenProgress();
|
||||||
}
|
}
|
||||||
|
|
||||||
oThis.fonts_loading_after_style[oThis.fonts_loading_after_style.length] = oThis.fonts_loading[0];
|
oThis.fonts_loading_after_style[oThis.fonts_loading_after_style.length] = oThis.fonts_loading[0];
|
||||||
oThis.fonts_loading.shift();
|
oThis.fonts_loading.shift();
|
||||||
oThis._LoadFonts();
|
oThis._LoadFonts();
|
||||||
@ -204447,7 +204447,7 @@ function DecodeBase64(imData, szSrc)
|
|||||||
{
|
{
|
||||||
this.embeddedFontFiles[font_index].SetStreamIndex(stream_index);
|
this.embeddedFontFiles[font_index].SetStreamIndex(stream_index);
|
||||||
};
|
};
|
||||||
|
|
||||||
function CGlobalImageLoader()
|
function CGlobalImageLoader()
|
||||||
{
|
{
|
||||||
this.map_image_index = {};
|
this.map_image_index = {};
|
||||||
@ -204459,7 +204459,7 @@ function DecodeBase64(imData, szSrc)
|
|||||||
|
|
||||||
this.bIsLoadDocumentFirst = false;
|
this.bIsLoadDocumentFirst = false;
|
||||||
|
|
||||||
this.bIsAsyncLoadDocumentImages = false;
|
this.bIsAsyncLoadDocumentImages = true;
|
||||||
|
|
||||||
this.bIsLoadDocumentImagesNoByOrder = true;
|
this.bIsLoadDocumentImagesNoByOrder = true;
|
||||||
this.nNoByOrderCounter = 0;
|
this.nNoByOrderCounter = 0;
|
||||||
@ -204520,7 +204520,15 @@ function DecodeBase64(imData, szSrc)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.LoadDocumentImagesCallback = function() {
|
||||||
|
|
||||||
|
if (this.ThemeLoader == null)
|
||||||
|
this.Api.asyncImagesDocumentEndLoaded();
|
||||||
|
else
|
||||||
|
this.ThemeLoader.asyncImagesEndLoaded();
|
||||||
|
}
|
||||||
|
|
||||||
this.LoadDocumentImages = function(_images, isUrl)
|
this.LoadDocumentImages = function(_images, isUrl)
|
||||||
{
|
{
|
||||||
// сначала заполним массив
|
// сначала заполним массив
|
||||||
@ -204548,13 +204556,10 @@ function DecodeBase64(imData, szSrc)
|
|||||||
{
|
{
|
||||||
this.LoadImageAsync(i);
|
this.LoadImageAsync(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.images_loading.splice(0, _len);
|
this.images_loading.splice(0, _len);
|
||||||
|
|
||||||
if (this.ThemeLoader == null)
|
var that = this;
|
||||||
this.Api.asyncImagesDocumentEndLoaded();
|
setTimeout(function() { that.LoadDocumentImagesCallback() }, 3000);
|
||||||
else
|
|
||||||
this.ThemeLoader.asyncImagesEndLoaded();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -204678,17 +204683,27 @@ function DecodeBase64(imData, szSrc)
|
|||||||
oImage.Status = ImageLoadStatus.Loading;
|
oImage.Status = ImageLoadStatus.Loading;
|
||||||
oImage.Image = new Image();
|
oImage.Image = new Image();
|
||||||
oThis.map_image_index[oImage.src] = oImage;
|
oThis.map_image_index[oImage.src] = oImage;
|
||||||
|
var oThat = oThis;
|
||||||
oImage.Image.onload = function(){
|
oImage.Image.onload = function(){
|
||||||
oImage.Status = ImageLoadStatus.Complete;
|
oImage.Status = ImageLoadStatus.Complete;
|
||||||
oThis.Api.asyncImageEndLoadedBackground(oImage);
|
oThat.Api.asyncImageEndLoadedBackground(oImage);
|
||||||
};
|
};
|
||||||
oImage.Image.onerror = function(){
|
oImage.Image.onerror = function(){
|
||||||
oImage.Status = ImageLoadStatus.Complete;
|
oImage.Status = ImageLoadStatus.Complete;
|
||||||
oImage.Image = null;
|
oImage.Image = null;
|
||||||
oThis.Api.asyncImageEndLoadedBackground(oImage);
|
oThat.Api.asyncImageEndLoadedBackground(oImage);
|
||||||
};
|
};
|
||||||
//oImage.Image.crossOrigin = 'anonymous';
|
//oImage.Image.crossOrigin = 'anonymous';
|
||||||
oThis.loadImageByUrl(oImage.Image, oImage.src);
|
|
||||||
|
// CRYPTPAD: if we find an image URL with #channel= in it
|
||||||
|
// then we need to ask cryptpad to get the blob
|
||||||
|
if (oImage.src.indexOf("#src=")!=-1)
|
||||||
|
window.parent.APP.getImageURL(oImage.src, function(url) {
|
||||||
|
oThis.loadImageByUrl(oImage.Image, url);
|
||||||
|
oThis.map_image_index[url] = oImage;
|
||||||
|
});
|
||||||
|
else
|
||||||
|
oThis.loadImageByUrl(oImage.Image, oImage.src);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.LoadImagesWithCallback = function(arr, loadImageCallBack, loadImageCallBackArgs)
|
this.LoadImagesWithCallback = function(arr, loadImageCallBack, loadImageCallBackArgs)
|
||||||
@ -205439,7 +205454,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
|
||||||
|
var that = this;
|
||||||
|
if (Url.indexOf("#src=")!=-1) {
|
||||||
|
window.parent.APP.getImageURL(Url, function(url) {
|
||||||
|
that.m_aNewImages.push( Url );
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.m_aNewImages.push( Url );
|
||||||
|
}
|
||||||
|
// CryptPad - End modification
|
||||||
};
|
};
|
||||||
//-----------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------
|
||||||
// Функции для работы с массивом m_aDC
|
// Функции для работы с массивом m_aDC
|
||||||
|
|||||||
55
www/common/onlyoffice/sdkjs/slide/sdk-all-min.js
vendored
55
www/common/onlyoffice/sdkjs/slide/sdk-all-min.js
vendored
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) Ascensio System SIA 2012-2019. All rights reserved
|
* Copyright (C) Ascensio System SIA 2012-2020. All rights reserved
|
||||||
*
|
*
|
||||||
* https://www.onlyoffice.com/
|
* https://www.onlyoffice.com/
|
||||||
*
|
*
|
||||||
@ -11484,7 +11484,7 @@ function isRealObject(obj)
|
|||||||
if (window['IS_NATIVE_EDITOR'])
|
if (window['IS_NATIVE_EDITOR'])
|
||||||
{
|
{
|
||||||
var stream = window["native"]["openFileCommand"](sFileUrl, changesUrl, Signature);
|
var stream = window["native"]["openFileCommand"](sFileUrl, changesUrl, Signature);
|
||||||
|
|
||||||
//получаем url к папке с файлом
|
//получаем url к папке с файлом
|
||||||
var url;
|
var url;
|
||||||
var nIndex = sFileUrl.lastIndexOf("/");
|
var nIndex = sFileUrl.lastIndexOf("/");
|
||||||
@ -11496,7 +11496,7 @@ function isRealObject(obj)
|
|||||||
} else {
|
} else {
|
||||||
bError = true;
|
bError = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bEndLoadFile = true;
|
bEndLoadFile = true;
|
||||||
onEndOpen();
|
onEndOpen();
|
||||||
}
|
}
|
||||||
@ -12384,6 +12384,10 @@ function isRealObject(obj)
|
|||||||
|
|
||||||
function UploadImageFiles(files, documentId, documentUserId, jwt, callback)
|
function UploadImageFiles(files, documentId, documentUserId, jwt, callback)
|
||||||
{
|
{
|
||||||
|
// CryptPad: we need to take control of the upload
|
||||||
|
window.parent.APP.UploadImageFiles(files, documentId, documentUserId, jwt, callback);
|
||||||
|
return;
|
||||||
|
|
||||||
if (files.length > 0)
|
if (files.length > 0)
|
||||||
{
|
{
|
||||||
var url = sUploadServiceLocalUrl + '/' + documentId + '/' + documentUserId + '/' + g_oDocumentUrls.getMaxIndex();
|
var url = sUploadServiceLocalUrl + '/' + documentId + '/' + documentUserId + '/' + g_oDocumentUrls.getMaxIndex();
|
||||||
@ -15594,6 +15598,7 @@ window["AscDesktopEditor_Save"] = function()
|
|||||||
window["AscDesktopEditor"]["OnSave"]();
|
window["AscDesktopEditor"]["OnSave"]();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (c) Copyright Ascensio System SIA 2010-2018
|
* (c) Copyright Ascensio System SIA 2010-2018
|
||||||
*
|
*
|
||||||
@ -21398,7 +21403,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
|
||||||
|
var that = this;
|
||||||
|
if (Url.indexOf("#src=")!=-1) {
|
||||||
|
window.parent.APP.getImageURL(Url, function(url) {
|
||||||
|
that.m_aNewImages.push( Url );
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.m_aNewImages.push( Url );
|
||||||
|
}
|
||||||
|
// CryptPad - End modification
|
||||||
};
|
};
|
||||||
//-----------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------
|
||||||
// Функции для работы с массивом m_aDC
|
// Функции для работы с массивом m_aDC
|
||||||
@ -24305,9 +24319,32 @@ function (window, undefined)
|
|||||||
baseEditorsApi.prototype._addImageUrl = function()
|
baseEditorsApi.prototype._addImageUrl = function()
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
// CRYPTPAD
|
||||||
|
// This method is necessary to add the loaded images to the list of loaded images
|
||||||
|
// The code is in slide/api.js
|
||||||
|
baseEditorsApi.prototype.asc_addImageCallback = function(res)
|
||||||
|
{
|
||||||
|
};
|
||||||
baseEditorsApi.prototype.asc_addImage = function()
|
baseEditorsApi.prototype.asc_addImage = function()
|
||||||
{
|
{
|
||||||
var t = this;
|
var t = this;
|
||||||
|
|
||||||
|
// CryptPad: we need to take control of the upload
|
||||||
|
// t.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage);
|
||||||
|
// This method calls back to the cryptpad onlyoffice inner.js to load the cryptad file dialog
|
||||||
|
window.parent.APP.AddImage(function(res) {
|
||||||
|
// This method adds the loaded image to the list of loaded images
|
||||||
|
t.asc_addImageCallback(res);
|
||||||
|
// This method activats the image
|
||||||
|
t._addImageUrl([res.url]);
|
||||||
|
// t.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage);
|
||||||
|
}, function() {
|
||||||
|
// t.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage);
|
||||||
|
t.sendEvent("asc_onError", error, c_oAscError.Level.NoCritical);
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
// Cryptpad end
|
||||||
|
|
||||||
AscCommon.ShowImageFileDialog(this.documentId, this.documentUserId, this.CoAuthoringApi.get_jwt(), function(error, files)
|
AscCommon.ShowImageFileDialog(this.documentId, this.documentUserId, this.CoAuthoringApi.get_jwt(), function(error, files)
|
||||||
{
|
{
|
||||||
t._uploadCallback(error, files);
|
t._uploadCallback(error, files);
|
||||||
@ -31279,6 +31316,16 @@ background-repeat: no-repeat;\
|
|||||||
return this.WordControl.m_oLogicDocument.canUnGroup();
|
return this.WordControl.m_oLogicDocument.canUnGroup();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// CRYPTPAD
|
||||||
|
// This method is necessary to add the loaded images to the list of loaded images
|
||||||
|
asc_docs_api.prototype.asc_addImageCallback = function(res)
|
||||||
|
{
|
||||||
|
g_oDocumentUrls.addImageUrl(res.name, res.url)
|
||||||
|
}
|
||||||
|
asc_docs_api.prototype.asyncImageEndLoadedBackground = function(_image)
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
asc_docs_api.prototype._addImageUrl = function(urls)
|
asc_docs_api.prototype._addImageUrl = function(urls)
|
||||||
{
|
{
|
||||||
if(this.isImageChangeUrl || this.isShapeImageChangeUrl || this.isSlideImageChangeUrl || this.isTextArtChangeUrl){
|
if(this.isImageChangeUrl || this.isShapeImageChangeUrl || this.isSlideImageChangeUrl || this.isTextArtChangeUrl){
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) Ascensio System SIA 2012-2019. All rights reserved
|
* Copyright (C) Ascensio System SIA 2012-2020. All rights reserved
|
||||||
*
|
*
|
||||||
* https://www.onlyoffice.com/
|
* https://www.onlyoffice.com/
|
||||||
*
|
*
|
||||||
@ -205451,7 +205451,7 @@ function DecodeBase64(imData, szSrc)
|
|||||||
{
|
{
|
||||||
this.Api = _api;
|
this.Api = _api;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.LoadEmbeddedFonts = function(url, _fonts)
|
this.LoadEmbeddedFonts = function(url, _fonts)
|
||||||
{
|
{
|
||||||
this.embeddedFilesPath = url;
|
this.embeddedFilesPath = url;
|
||||||
@ -205720,7 +205720,7 @@ function DecodeBase64(imData, szSrc)
|
|||||||
oThis.Api.OpenDocumentProgress.CurrentFont++;
|
oThis.Api.OpenDocumentProgress.CurrentFont++;
|
||||||
oThis.Api.SendOpenProgress();
|
oThis.Api.SendOpenProgress();
|
||||||
}
|
}
|
||||||
|
|
||||||
oThis.fonts_loading_after_style[oThis.fonts_loading_after_style.length] = oThis.fonts_loading[0];
|
oThis.fonts_loading_after_style[oThis.fonts_loading_after_style.length] = oThis.fonts_loading[0];
|
||||||
oThis.fonts_loading.shift();
|
oThis.fonts_loading.shift();
|
||||||
oThis._LoadFonts();
|
oThis._LoadFonts();
|
||||||
@ -205795,7 +205795,7 @@ function DecodeBase64(imData, szSrc)
|
|||||||
{
|
{
|
||||||
this.embeddedFontFiles[font_index].SetStreamIndex(stream_index);
|
this.embeddedFontFiles[font_index].SetStreamIndex(stream_index);
|
||||||
};
|
};
|
||||||
|
|
||||||
function CGlobalImageLoader()
|
function CGlobalImageLoader()
|
||||||
{
|
{
|
||||||
this.map_image_index = {};
|
this.map_image_index = {};
|
||||||
@ -205807,7 +205807,7 @@ function DecodeBase64(imData, szSrc)
|
|||||||
|
|
||||||
this.bIsLoadDocumentFirst = false;
|
this.bIsLoadDocumentFirst = false;
|
||||||
|
|
||||||
this.bIsAsyncLoadDocumentImages = false;
|
this.bIsAsyncLoadDocumentImages = true;
|
||||||
|
|
||||||
this.bIsLoadDocumentImagesNoByOrder = true;
|
this.bIsLoadDocumentImagesNoByOrder = true;
|
||||||
this.nNoByOrderCounter = 0;
|
this.nNoByOrderCounter = 0;
|
||||||
@ -205868,7 +205868,15 @@ function DecodeBase64(imData, szSrc)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.LoadDocumentImagesCallback = function() {
|
||||||
|
|
||||||
|
if (this.ThemeLoader == null)
|
||||||
|
this.Api.asyncImagesDocumentEndLoaded();
|
||||||
|
else
|
||||||
|
this.ThemeLoader.asyncImagesEndLoaded();
|
||||||
|
}
|
||||||
|
|
||||||
this.LoadDocumentImages = function(_images, isUrl)
|
this.LoadDocumentImages = function(_images, isUrl)
|
||||||
{
|
{
|
||||||
// сначала заполним массив
|
// сначала заполним массив
|
||||||
@ -205896,13 +205904,10 @@ function DecodeBase64(imData, szSrc)
|
|||||||
{
|
{
|
||||||
this.LoadImageAsync(i);
|
this.LoadImageAsync(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.images_loading.splice(0, _len);
|
this.images_loading.splice(0, _len);
|
||||||
|
|
||||||
if (this.ThemeLoader == null)
|
var that = this;
|
||||||
this.Api.asyncImagesDocumentEndLoaded();
|
setTimeout(function() { that.LoadDocumentImagesCallback() }, 3000);
|
||||||
else
|
|
||||||
this.ThemeLoader.asyncImagesEndLoaded();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -206026,17 +206031,27 @@ function DecodeBase64(imData, szSrc)
|
|||||||
oImage.Status = ImageLoadStatus.Loading;
|
oImage.Status = ImageLoadStatus.Loading;
|
||||||
oImage.Image = new Image();
|
oImage.Image = new Image();
|
||||||
oThis.map_image_index[oImage.src] = oImage;
|
oThis.map_image_index[oImage.src] = oImage;
|
||||||
|
var oThat = oThis;
|
||||||
oImage.Image.onload = function(){
|
oImage.Image.onload = function(){
|
||||||
oImage.Status = ImageLoadStatus.Complete;
|
oImage.Status = ImageLoadStatus.Complete;
|
||||||
oThis.Api.asyncImageEndLoadedBackground(oImage);
|
oThat.Api.asyncImageEndLoadedBackground(oImage);
|
||||||
};
|
};
|
||||||
oImage.Image.onerror = function(){
|
oImage.Image.onerror = function(){
|
||||||
oImage.Status = ImageLoadStatus.Complete;
|
oImage.Status = ImageLoadStatus.Complete;
|
||||||
oImage.Image = null;
|
oImage.Image = null;
|
||||||
oThis.Api.asyncImageEndLoadedBackground(oImage);
|
oThat.Api.asyncImageEndLoadedBackground(oImage);
|
||||||
};
|
};
|
||||||
//oImage.Image.crossOrigin = 'anonymous';
|
//oImage.Image.crossOrigin = 'anonymous';
|
||||||
oThis.loadImageByUrl(oImage.Image, oImage.src);
|
|
||||||
|
// CRYPTPAD: if we find an image URL with #channel= in it
|
||||||
|
// then we need to ask cryptpad to get the blob
|
||||||
|
if (oImage.src.indexOf("#src=")!=-1)
|
||||||
|
window.parent.APP.getImageURL(oImage.src, function(url) {
|
||||||
|
oThis.loadImageByUrl(oImage.Image, url);
|
||||||
|
oThis.map_image_index[url] = oImage;
|
||||||
|
});
|
||||||
|
else
|
||||||
|
oThis.loadImageByUrl(oImage.Image, oImage.src);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.LoadImagesWithCallback = function(arr, loadImageCallBack, loadImageCallBackArgs)
|
this.LoadImagesWithCallback = function(arr, loadImageCallBack, loadImageCallBackArgs)
|
||||||
|
|||||||
57
www/common/onlyoffice/sdkjs/word/sdk-all-min.js
vendored
57
www/common/onlyoffice/sdkjs/word/sdk-all-min.js
vendored
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) Ascensio System SIA 2012-2019. All rights reserved
|
* Copyright (C) Ascensio System SIA 2012-2020. All rights reserved
|
||||||
*
|
*
|
||||||
* https://www.onlyoffice.com/
|
* https://www.onlyoffice.com/
|
||||||
*
|
*
|
||||||
@ -11484,7 +11484,7 @@ function isRealObject(obj)
|
|||||||
if (window['IS_NATIVE_EDITOR'])
|
if (window['IS_NATIVE_EDITOR'])
|
||||||
{
|
{
|
||||||
var stream = window["native"]["openFileCommand"](sFileUrl, changesUrl, Signature);
|
var stream = window["native"]["openFileCommand"](sFileUrl, changesUrl, Signature);
|
||||||
|
|
||||||
//получаем url к папке с файлом
|
//получаем url к папке с файлом
|
||||||
var url;
|
var url;
|
||||||
var nIndex = sFileUrl.lastIndexOf("/");
|
var nIndex = sFileUrl.lastIndexOf("/");
|
||||||
@ -11496,7 +11496,7 @@ function isRealObject(obj)
|
|||||||
} else {
|
} else {
|
||||||
bError = true;
|
bError = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bEndLoadFile = true;
|
bEndLoadFile = true;
|
||||||
onEndOpen();
|
onEndOpen();
|
||||||
}
|
}
|
||||||
@ -12384,6 +12384,10 @@ function isRealObject(obj)
|
|||||||
|
|
||||||
function UploadImageFiles(files, documentId, documentUserId, jwt, callback)
|
function UploadImageFiles(files, documentId, documentUserId, jwt, callback)
|
||||||
{
|
{
|
||||||
|
// CryptPad: we need to take control of the upload
|
||||||
|
window.parent.APP.UploadImageFiles(files, documentId, documentUserId, jwt, callback);
|
||||||
|
return;
|
||||||
|
|
||||||
if (files.length > 0)
|
if (files.length > 0)
|
||||||
{
|
{
|
||||||
var url = sUploadServiceLocalUrl + '/' + documentId + '/' + documentUserId + '/' + g_oDocumentUrls.getMaxIndex();
|
var url = sUploadServiceLocalUrl + '/' + documentId + '/' + documentUserId + '/' + g_oDocumentUrls.getMaxIndex();
|
||||||
@ -15594,6 +15598,7 @@ window["AscDesktopEditor_Save"] = function()
|
|||||||
window["AscDesktopEditor"]["OnSave"]();
|
window["AscDesktopEditor"]["OnSave"]();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (c) Copyright Ascensio System SIA 2010-2018
|
* (c) Copyright Ascensio System SIA 2010-2018
|
||||||
*
|
*
|
||||||
@ -21531,7 +21536,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
|
||||||
|
var that = this;
|
||||||
|
if (Url.indexOf("#src=")!=-1) {
|
||||||
|
window.parent.APP.getImageURL(Url, function(url) {
|
||||||
|
that.m_aNewImages.push( Url );
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.m_aNewImages.push( Url );
|
||||||
|
}
|
||||||
|
// CryptPad - End modification
|
||||||
};
|
};
|
||||||
//-----------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------
|
||||||
// Функции для работы с массивом m_aDC
|
// Функции для работы с массивом m_aDC
|
||||||
@ -24323,9 +24337,32 @@ function (window, undefined)
|
|||||||
baseEditorsApi.prototype._addImageUrl = function()
|
baseEditorsApi.prototype._addImageUrl = function()
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
// CRYPTPAD
|
||||||
|
// This method is necessary to add the loaded images to the list of loaded images
|
||||||
|
// The code is in slide/api.js
|
||||||
|
baseEditorsApi.prototype.asc_addImageCallback = function(res)
|
||||||
|
{
|
||||||
|
};
|
||||||
baseEditorsApi.prototype.asc_addImage = function()
|
baseEditorsApi.prototype.asc_addImage = function()
|
||||||
{
|
{
|
||||||
var t = this;
|
var t = this;
|
||||||
|
|
||||||
|
// CryptPad: we need to take control of the upload
|
||||||
|
// t.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage);
|
||||||
|
// This method calls back to the cryptpad onlyoffice inner.js to load the cryptad file dialog
|
||||||
|
window.parent.APP.AddImage(function(res) {
|
||||||
|
// This method adds the loaded image to the list of loaded images
|
||||||
|
t.asc_addImageCallback(res);
|
||||||
|
// This method activats the image
|
||||||
|
t._addImageUrl([res.url]);
|
||||||
|
// t.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage);
|
||||||
|
}, function() {
|
||||||
|
// t.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage);
|
||||||
|
t.sendEvent("asc_onError", error, c_oAscError.Level.NoCritical);
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
// Cryptpad end
|
||||||
|
|
||||||
AscCommon.ShowImageFileDialog(this.documentId, this.documentUserId, this.CoAuthoringApi.get_jwt(), function(error, files)
|
AscCommon.ShowImageFileDialog(this.documentId, this.documentUserId, this.CoAuthoringApi.get_jwt(), function(error, files)
|
||||||
{
|
{
|
||||||
t._uploadCallback(error, files);
|
t._uploadCallback(error, files);
|
||||||
@ -32084,7 +32121,15 @@ background-repeat: no-repeat;\
|
|||||||
{
|
{
|
||||||
this.AddImageUrl(AscCommon.getFullImageSrc2(url));
|
this.AddImageUrl(AscCommon.getFullImageSrc2(url));
|
||||||
};
|
};
|
||||||
|
// CRYPTPAD
|
||||||
|
// This method is necessary to add the loaded images to the list of loaded images
|
||||||
|
asc_docs_api.prototype.asc_addImageCallback = function(res)
|
||||||
|
{
|
||||||
|
g_oDocumentUrls.addImageUrl(res.name, res.url)
|
||||||
|
}
|
||||||
|
asc_docs_api.prototype.asyncImageEndLoadedBackground = function(_image)
|
||||||
|
{
|
||||||
|
};
|
||||||
asc_docs_api.prototype._addImageUrl = function(urls)
|
asc_docs_api.prototype._addImageUrl = function(urls)
|
||||||
{
|
{
|
||||||
if(this.isImageChangeUrl || this.isShapeImageChangeUrl){
|
if(this.isImageChangeUrl || this.isShapeImageChangeUrl){
|
||||||
@ -37306,4 +37351,4 @@ background-repeat: no-repeat;\
|
|||||||
AscCommon.g_font_loader.LoadDocumentFonts2(_fonts);
|
AscCommon.g_font_loader.LoadDocumentFonts2(_fonts);
|
||||||
};
|
};
|
||||||
|
|
||||||
})(window, window.document);
|
})(window, window.document);
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) Ascensio System SIA 2012-2019. All rights reserved
|
* Copyright (C) Ascensio System SIA 2012-2020. All rights reserved
|
||||||
*
|
*
|
||||||
* https://www.onlyoffice.com/
|
* https://www.onlyoffice.com/
|
||||||
*
|
*
|
||||||
@ -204606,7 +204606,7 @@ function DecodeBase64(imData, szSrc)
|
|||||||
{
|
{
|
||||||
this.Api = _api;
|
this.Api = _api;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.LoadEmbeddedFonts = function(url, _fonts)
|
this.LoadEmbeddedFonts = function(url, _fonts)
|
||||||
{
|
{
|
||||||
this.embeddedFilesPath = url;
|
this.embeddedFilesPath = url;
|
||||||
@ -204875,7 +204875,7 @@ function DecodeBase64(imData, szSrc)
|
|||||||
oThis.Api.OpenDocumentProgress.CurrentFont++;
|
oThis.Api.OpenDocumentProgress.CurrentFont++;
|
||||||
oThis.Api.SendOpenProgress();
|
oThis.Api.SendOpenProgress();
|
||||||
}
|
}
|
||||||
|
|
||||||
oThis.fonts_loading_after_style[oThis.fonts_loading_after_style.length] = oThis.fonts_loading[0];
|
oThis.fonts_loading_after_style[oThis.fonts_loading_after_style.length] = oThis.fonts_loading[0];
|
||||||
oThis.fonts_loading.shift();
|
oThis.fonts_loading.shift();
|
||||||
oThis._LoadFonts();
|
oThis._LoadFonts();
|
||||||
@ -204950,7 +204950,7 @@ function DecodeBase64(imData, szSrc)
|
|||||||
{
|
{
|
||||||
this.embeddedFontFiles[font_index].SetStreamIndex(stream_index);
|
this.embeddedFontFiles[font_index].SetStreamIndex(stream_index);
|
||||||
};
|
};
|
||||||
|
|
||||||
function CGlobalImageLoader()
|
function CGlobalImageLoader()
|
||||||
{
|
{
|
||||||
this.map_image_index = {};
|
this.map_image_index = {};
|
||||||
@ -204962,7 +204962,7 @@ function DecodeBase64(imData, szSrc)
|
|||||||
|
|
||||||
this.bIsLoadDocumentFirst = false;
|
this.bIsLoadDocumentFirst = false;
|
||||||
|
|
||||||
this.bIsAsyncLoadDocumentImages = false;
|
this.bIsAsyncLoadDocumentImages = true;
|
||||||
|
|
||||||
this.bIsLoadDocumentImagesNoByOrder = true;
|
this.bIsLoadDocumentImagesNoByOrder = true;
|
||||||
this.nNoByOrderCounter = 0;
|
this.nNoByOrderCounter = 0;
|
||||||
@ -205023,7 +205023,15 @@ function DecodeBase64(imData, szSrc)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.LoadDocumentImagesCallback = function() {
|
||||||
|
|
||||||
|
if (this.ThemeLoader == null)
|
||||||
|
this.Api.asyncImagesDocumentEndLoaded();
|
||||||
|
else
|
||||||
|
this.ThemeLoader.asyncImagesEndLoaded();
|
||||||
|
}
|
||||||
|
|
||||||
this.LoadDocumentImages = function(_images, isUrl)
|
this.LoadDocumentImages = function(_images, isUrl)
|
||||||
{
|
{
|
||||||
// сначала заполним массив
|
// сначала заполним массив
|
||||||
@ -205051,13 +205059,10 @@ function DecodeBase64(imData, szSrc)
|
|||||||
{
|
{
|
||||||
this.LoadImageAsync(i);
|
this.LoadImageAsync(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.images_loading.splice(0, _len);
|
this.images_loading.splice(0, _len);
|
||||||
|
|
||||||
if (this.ThemeLoader == null)
|
var that = this;
|
||||||
this.Api.asyncImagesDocumentEndLoaded();
|
setTimeout(function() { that.LoadDocumentImagesCallback() }, 3000);
|
||||||
else
|
|
||||||
this.ThemeLoader.asyncImagesEndLoaded();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -205181,17 +205186,27 @@ function DecodeBase64(imData, szSrc)
|
|||||||
oImage.Status = ImageLoadStatus.Loading;
|
oImage.Status = ImageLoadStatus.Loading;
|
||||||
oImage.Image = new Image();
|
oImage.Image = new Image();
|
||||||
oThis.map_image_index[oImage.src] = oImage;
|
oThis.map_image_index[oImage.src] = oImage;
|
||||||
|
var oThat = oThis;
|
||||||
oImage.Image.onload = function(){
|
oImage.Image.onload = function(){
|
||||||
oImage.Status = ImageLoadStatus.Complete;
|
oImage.Status = ImageLoadStatus.Complete;
|
||||||
oThis.Api.asyncImageEndLoadedBackground(oImage);
|
oThat.Api.asyncImageEndLoadedBackground(oImage);
|
||||||
};
|
};
|
||||||
oImage.Image.onerror = function(){
|
oImage.Image.onerror = function(){
|
||||||
oImage.Status = ImageLoadStatus.Complete;
|
oImage.Status = ImageLoadStatus.Complete;
|
||||||
oImage.Image = null;
|
oImage.Image = null;
|
||||||
oThis.Api.asyncImageEndLoadedBackground(oImage);
|
oThat.Api.asyncImageEndLoadedBackground(oImage);
|
||||||
};
|
};
|
||||||
//oImage.Image.crossOrigin = 'anonymous';
|
//oImage.Image.crossOrigin = 'anonymous';
|
||||||
oThis.loadImageByUrl(oImage.Image, oImage.src);
|
|
||||||
|
// CRYPTPAD: if we find an image URL with #channel= in it
|
||||||
|
// then we need to ask cryptpad to get the blob
|
||||||
|
if (oImage.src.indexOf("#src=")!=-1)
|
||||||
|
window.parent.APP.getImageURL(oImage.src, function(url) {
|
||||||
|
oThis.loadImageByUrl(oImage.Image, url);
|
||||||
|
oThis.map_image_index[url] = oImage;
|
||||||
|
});
|
||||||
|
else
|
||||||
|
oThis.loadImageByUrl(oImage.Image, oImage.src);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.LoadImagesWithCallback = function(arr, loadImageCallBack, loadImageCallBackArgs)
|
this.LoadImagesWithCallback = function(arr, loadImageCallBack, loadImageCallBackArgs)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user