From f336d0ef0a561c3a00ef22c6288d92c02fdc2c6e Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 26 Aug 2021 15:14:29 +0300 Subject: [PATCH] Fix Bug 50683 --- apps/documenteditor/main/app/controller/Toolbar.js | 13 ++++++++++--- .../mobile/src/controller/add/AddImage.jsx | 2 +- .../main/app/controller/Toolbar.js | 13 ++++++++++--- .../main/app/view/DocumentHolder.js | 2 +- .../mobile/src/controller/add/AddImage.jsx | 2 +- .../main/app/controller/Toolbar.js | 13 ++++++++++--- .../mobile/src/controller/add/AddImage.jsx | 2 +- 7 files changed, 34 insertions(+), 13 deletions(-) diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index e03d1e1df..5c19fbc84 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -1584,7 +1584,7 @@ define([ var checkUrl = value.replace(/ /g, ''); if (!_.isEmpty(checkUrl)) { me.toolbar.fireEvent('insertimage', me.toolbar); - me.api.AddImageUrl(checkUrl); + me.api.AddImageUrl([checkUrl]); Common.component.Analytics.trackEvent('ToolBar', 'Image'); } else { @@ -1618,9 +1618,16 @@ define([ }, insertImageFromStorage: function(data) { - if (data && data.url && (!data.c || data.c=='add')) { + if (data && (data.url || data.images) && (!data.c || data.c=='add')) { this.toolbar.fireEvent('insertimage', this.toolbar); - this.api.AddImageUrl(data.url, undefined, data.token);// for loading from storage + var arr = []; + if (data.images && data.images.length>0) { + for (var i=0; i0) && this.api.AddImageUrl(arr, undefined, data.token);// for loading from storage Common.component.Analytics.trackEvent('ToolBar', 'Image'); } }, diff --git a/apps/documenteditor/mobile/src/controller/add/AddImage.jsx b/apps/documenteditor/mobile/src/controller/add/AddImage.jsx index c3a10eaff..73145f992 100644 --- a/apps/documenteditor/mobile/src/controller/add/AddImage.jsx +++ b/apps/documenteditor/mobile/src/controller/add/AddImage.jsx @@ -36,7 +36,7 @@ class AddImageController extends Component { if ((/((^https?)|(^ftp)):\/\/.+/i.test(_value))) { this.closeModal(); const api = Common.EditorApi.get(); - api.AddImageUrl(_value); + api.AddImageUrl([_value]); } else { f7.dialog.alert(_t.txtNotUrl, _t.notcriticalErrorTitle); } diff --git a/apps/presentationeditor/main/app/controller/Toolbar.js b/apps/presentationeditor/main/app/controller/Toolbar.js index 50652a01b..eff6bf4c4 100644 --- a/apps/presentationeditor/main/app/controller/Toolbar.js +++ b/apps/presentationeditor/main/app/controller/Toolbar.js @@ -1584,7 +1584,7 @@ define([ var checkUrl = value.replace(/ /g, ''); if (!_.isEmpty(checkUrl)) { me.toolbar.fireEvent('insertimage', me.toolbar); - me.api.AddImageUrl(checkUrl); + me.api.AddImageUrl([checkUrl]); Common.component.Analytics.trackEvent('ToolBar', 'Image'); } else { @@ -1618,9 +1618,16 @@ define([ }, insertImageFromStorage: function(data) { - if (data && data.url && (!data.c || data.c=='add')) { + if (data && (data.url || data.images) && (!data.c || data.c=='add')) { this.toolbar.fireEvent('insertimage', this.toolbar); - this.api.AddImageUrl(data.url, undefined, data.token);// for loading from storage + var arr = []; + if (data.images && data.images.length>0) { + for (var i=0; i0) && this.api.AddImageUrl(arr, undefined, data.token);// for loading from storage Common.component.Analytics.trackEvent('ToolBar', 'Image'); } }, diff --git a/apps/presentationeditor/main/app/view/DocumentHolder.js b/apps/presentationeditor/main/app/view/DocumentHolder.js index 1dfba5554..e120004d1 100644 --- a/apps/presentationeditor/main/app/view/DocumentHolder.js +++ b/apps/presentationeditor/main/app/view/DocumentHolder.js @@ -3633,7 +3633,7 @@ define([ var checkUrl = value.replace(/ /g, ''); if (!_.isEmpty(checkUrl)) { if (placeholder) - me.api.AddImageUrl(checkUrl, undefined, undefined, obj); + me.api.AddImageUrl([checkUrl], undefined, undefined, obj); else { var props = new Asc.asc_CImgProperty(); props.put_ImageUrl(checkUrl); diff --git a/apps/presentationeditor/mobile/src/controller/add/AddImage.jsx b/apps/presentationeditor/mobile/src/controller/add/AddImage.jsx index 4aafae09b..ad68b85b0 100644 --- a/apps/presentationeditor/mobile/src/controller/add/AddImage.jsx +++ b/apps/presentationeditor/mobile/src/controller/add/AddImage.jsx @@ -36,7 +36,7 @@ class AddImageController extends Component { if ((/((^https?)|(^ftp)):\/\/.+/i.test(_value))) { this.closeModal(); const api = Common.EditorApi.get(); - api.AddImageUrl(_value); + api.AddImageUrl([_value]); } else { f7.dialog.alert(_t.txtNotUrl, _t.notcriticalErrorTitle); } diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index d5df8f779..cf64478a0 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -865,7 +865,7 @@ define([ var checkUrl = value.replace(/\s/g, ''); if (!_.isEmpty(checkUrl)) { me.toolbar.fireEvent('insertimage', me.toolbar); - me.api.asc_addImageDrawingObject(checkUrl); + me.api.asc_addImageDrawingObject([checkUrl]); Common.component.Analytics.trackEvent('ToolBar', 'Image'); } else { @@ -899,9 +899,16 @@ define([ }, insertImageFromStorage: function(data) { - if (data && data.url && (!data.c || data.c=='add')) { + if (data && (data.url || data.images) && (!data.c || data.c=='add')) { this.toolbar.fireEvent('insertimage', this.toolbar); - this.api.asc_addImageDrawingObject(data.url, undefined, data.token);// for loading from storage + var arr = []; + if (data.images && data.images.length>0) { + for (var i=0; i0) && this.api.asc_addImageDrawingObject(arr, undefined, data.token);// for loading from storage Common.component.Analytics.trackEvent('ToolBar', 'Image'); } }, diff --git a/apps/spreadsheeteditor/mobile/src/controller/add/AddImage.jsx b/apps/spreadsheeteditor/mobile/src/controller/add/AddImage.jsx index 10815d5f4..8939dc6ab 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/add/AddImage.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/add/AddImage.jsx @@ -36,7 +36,7 @@ class AddImageController extends Component { if ((/((^https?)|(^ftp)):\/\/.+/i.test(_value))) { this.closeModal(); const api = Common.EditorApi.get(); - api.asc_addImageDrawingObject(_value); + api.asc_addImageDrawingObject([_value]); } else { f7.dialog.alert(_t.txtNotUrl, _t.notcriticalErrorTitle); }