Fix loading images from storage

This commit is contained in:
Julia Radzhabova 2021-08-27 14:07:50 +03:00
parent 9df3f537c8
commit 7b57bdb6b7
12 changed files with 45 additions and 36 deletions

View file

@ -1618,8 +1618,15 @@ define([
},
insertImageFromStorage: function(data) {
if (data && (data.url || data.images) && (!data.c || data.c=='add')) {
if (data && data._urls && (!data.c || data.c=='add')) {
this.toolbar.fireEvent('insertimage', this.toolbar);
(data._urls.length>0) && this.api.AddImageUrl(data._urls, undefined, data.token);// for loading from storage
Common.component.Analytics.trackEvent('ToolBar', 'Image');
}
},
insertImage: function(data) { // gateway
if (data && (data.url || data.images)) {
var arr = [];
if (data.images && data.images.length>0) {
for (var i=0; i<data.images.length; i++) {
@ -1627,12 +1634,8 @@ define([
}
} else
data.url && arr.push(data.url);
(arr.length>0) && this.api.AddImageUrl(arr, undefined, data.token);// for loading from storage
Common.component.Analytics.trackEvent('ToolBar', 'Image');
data._urls = arr;
}
},
insertImage: function(data) { // gateway
Common.NotificationCenter.trigger('storage:image-insert', data);
},

View file

@ -711,8 +711,8 @@ define([
},
insertImageFromStorage: function(data) {
if (data && data.url && data.c=='control') {
this.setImageUrl(data.url, data.token);
if (data && data._urls && data.c=='control') {
this.setImageUrl(data._urls[0], data.token);
}
},

View file

@ -495,8 +495,8 @@ define([
},
insertImageFromStorage: function(data) {
if (data && data.url && data.c=='change') {
this.setImageUrl(data.url, data.token);
if (data && data._urls && data.c=='change') {
this.setImageUrl(data._urls[0], data.token);
}
},

View file

@ -719,8 +719,8 @@ define([
},
insertImageFromStorage: function(data) {
if (data && data.url && data.c=='fill') {
this.setImageUrl(data.url, data.token);
if (data && data._urls && data.c=='fill') {
this.setImageUrl(data._urls[0], data.token);
}
},

View file

@ -411,8 +411,8 @@ define(['text!documenteditor/main/app/template/WatermarkSettings.template',
this.api.asc_registerCallback('asc_onWatermarkImageLoaded', onApiWMLoaded);
var insertImageFromStorage = function(data) {
if (data && data.url && data.c=='watermark') {
me.props.put_ImageUrl(data.url, data.token);
if (data && data._urls && data.c=='watermark') {
me.props.put_ImageUrl(data._urls[0], data.token);
}
};
Common.NotificationCenter.on('storage:image-insert', insertImageFromStorage);

View file

@ -1618,8 +1618,15 @@ define([
},
insertImageFromStorage: function(data) {
if (data && (data.url || data.images) && (!data.c || data.c=='add')) {
if (data && data._urls && (!data.c || data.c=='add')) {
this.toolbar.fireEvent('insertimage', this.toolbar);
(data._urls.length>0) && this.api.AddImageUrl(data._urls, undefined, data.token);// for loading from storage
Common.component.Analytics.trackEvent('ToolBar', 'Image');
}
},
insertImage: function(data) { // gateway
if (data && (data.url || data.images)) {
var arr = [];
if (data.images && data.images.length>0) {
for (var i=0; i<data.images.length; i++) {
@ -1627,12 +1634,8 @@ define([
}
} else
data.url && arr.push(data.url);
(arr.length>0) && this.api.AddImageUrl(arr, undefined, data.token);// for loading from storage
Common.component.Analytics.trackEvent('ToolBar', 'Image');
data._urls = arr;
}
},
insertImage: function(data) { // gateway
Common.NotificationCenter.trigger('storage:image-insert', data);
},

View file

@ -331,8 +331,8 @@ define([
},
insertImageFromStorage: function(data) {
if (data && data.url && data.c=='change') {
this.setImageUrl(data.url, data.token);
if (data && data._urls && data.c=='change') {
this.setImageUrl(data._urls[0], data.token);
}
},

View file

@ -659,8 +659,8 @@ define([
},
insertImageFromStorage: function(data) {
if (data && data.url && data.c=='fill') {
this.setImageUrl(data.url, data.token);
if (data && data._urls && data.c=='fill') {
this.setImageUrl(data._urls[0], data.token);
}
},

View file

@ -639,8 +639,8 @@ define([
},
insertImageFromStorage: function(data) {
if (data && data.url && data.c=='slide') {
this.setImageUrl(data.url, data.token);
if (data && data._urls && data.c=='slide') {
this.setImageUrl(data._urls[0], data.token);
}
},

View file

@ -899,8 +899,15 @@ define([
},
insertImageFromStorage: function(data) {
if (data && (data.url || data.images) && (!data.c || data.c=='add')) {
if (data && data._urls && (!data.c || data.c=='add')) {
this.toolbar.fireEvent('insertimage', this.toolbar);
(data._urls.length>0) && this.api.asc_addImageDrawingObject(data._urls, undefined, data.token);// for loading from storage
Common.component.Analytics.trackEvent('ToolBar', 'Image');
}
},
insertImage: function(data) { // gateway
if (data && (data.url || data.images)) {
var arr = [];
if (data.images && data.images.length>0) {
for (var i=0; i<data.images.length; i++) {
@ -908,12 +915,8 @@ define([
}
} else
data.url && arr.push(data.url);
(arr.length>0) && this.api.asc_addImageDrawingObject(arr, undefined, data.token);// for loading from storage
Common.component.Analytics.trackEvent('ToolBar', 'Image');
data._urls = arr;
}
},
insertImage: function(data) { // gateway
Common.NotificationCenter.trigger('storage:image-insert', data);
},

View file

@ -468,8 +468,8 @@ define([
},
insertImageFromStorage: function(data) {
if (data && data.url && data.c=='change') {
this.setImageUrl(data.url, data.token);
if (data && data._urls && data.c=='change') {
this.setImageUrl(data._urls[0], data.token);
}
},

View file

@ -679,8 +679,8 @@ define([
},
insertImageFromStorage: function(data) {
if (data && data.url && data.c=='fill') {
this.setImageUrl(data.url, data.token);
if (data && data._urls && data.c=='fill') {
this.setImageUrl(data._urls[0], data.token);
}
},