Fix Bug 50683

This commit is contained in:
Julia Radzhabova 2021-08-26 15:14:29 +03:00
parent ca4f5cb820
commit f336d0ef0a
7 changed files with 34 additions and 13 deletions

View file

@ -1584,7 +1584,7 @@ define([
var checkUrl = value.replace(/ /g, ''); var checkUrl = value.replace(/ /g, '');
if (!_.isEmpty(checkUrl)) { if (!_.isEmpty(checkUrl)) {
me.toolbar.fireEvent('insertimage', me.toolbar); me.toolbar.fireEvent('insertimage', me.toolbar);
me.api.AddImageUrl(checkUrl); me.api.AddImageUrl([checkUrl]);
Common.component.Analytics.trackEvent('ToolBar', 'Image'); Common.component.Analytics.trackEvent('ToolBar', 'Image');
} else { } else {
@ -1618,9 +1618,16 @@ define([
}, },
insertImageFromStorage: function(data) { 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.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; i<data.images.length; i++) {
data.images[i] && data.images[i].url && arr.push( data.images[i].url);
}
} 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'); Common.component.Analytics.trackEvent('ToolBar', 'Image');
} }
}, },

View file

@ -36,7 +36,7 @@ class AddImageController extends Component {
if ((/((^https?)|(^ftp)):\/\/.+/i.test(_value))) { if ((/((^https?)|(^ftp)):\/\/.+/i.test(_value))) {
this.closeModal(); this.closeModal();
const api = Common.EditorApi.get(); const api = Common.EditorApi.get();
api.AddImageUrl(_value); api.AddImageUrl([_value]);
} else { } else {
f7.dialog.alert(_t.txtNotUrl, _t.notcriticalErrorTitle); f7.dialog.alert(_t.txtNotUrl, _t.notcriticalErrorTitle);
} }

View file

@ -1584,7 +1584,7 @@ define([
var checkUrl = value.replace(/ /g, ''); var checkUrl = value.replace(/ /g, '');
if (!_.isEmpty(checkUrl)) { if (!_.isEmpty(checkUrl)) {
me.toolbar.fireEvent('insertimage', me.toolbar); me.toolbar.fireEvent('insertimage', me.toolbar);
me.api.AddImageUrl(checkUrl); me.api.AddImageUrl([checkUrl]);
Common.component.Analytics.trackEvent('ToolBar', 'Image'); Common.component.Analytics.trackEvent('ToolBar', 'Image');
} else { } else {
@ -1618,9 +1618,16 @@ define([
}, },
insertImageFromStorage: function(data) { 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.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; i<data.images.length; i++) {
data.images[i] && data.images[i].url && arr.push( data.images[i].url);
}
} 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'); Common.component.Analytics.trackEvent('ToolBar', 'Image');
} }
}, },

View file

@ -3633,7 +3633,7 @@ define([
var checkUrl = value.replace(/ /g, ''); var checkUrl = value.replace(/ /g, '');
if (!_.isEmpty(checkUrl)) { if (!_.isEmpty(checkUrl)) {
if (placeholder) if (placeholder)
me.api.AddImageUrl(checkUrl, undefined, undefined, obj); me.api.AddImageUrl([checkUrl], undefined, undefined, obj);
else { else {
var props = new Asc.asc_CImgProperty(); var props = new Asc.asc_CImgProperty();
props.put_ImageUrl(checkUrl); props.put_ImageUrl(checkUrl);

View file

@ -36,7 +36,7 @@ class AddImageController extends Component {
if ((/((^https?)|(^ftp)):\/\/.+/i.test(_value))) { if ((/((^https?)|(^ftp)):\/\/.+/i.test(_value))) {
this.closeModal(); this.closeModal();
const api = Common.EditorApi.get(); const api = Common.EditorApi.get();
api.AddImageUrl(_value); api.AddImageUrl([_value]);
} else { } else {
f7.dialog.alert(_t.txtNotUrl, _t.notcriticalErrorTitle); f7.dialog.alert(_t.txtNotUrl, _t.notcriticalErrorTitle);
} }

View file

@ -865,7 +865,7 @@ define([
var checkUrl = value.replace(/\s/g, ''); var checkUrl = value.replace(/\s/g, '');
if (!_.isEmpty(checkUrl)) { if (!_.isEmpty(checkUrl)) {
me.toolbar.fireEvent('insertimage', me.toolbar); me.toolbar.fireEvent('insertimage', me.toolbar);
me.api.asc_addImageDrawingObject(checkUrl); me.api.asc_addImageDrawingObject([checkUrl]);
Common.component.Analytics.trackEvent('ToolBar', 'Image'); Common.component.Analytics.trackEvent('ToolBar', 'Image');
} else { } else {
@ -899,9 +899,16 @@ define([
}, },
insertImageFromStorage: function(data) { 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.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; i<data.images.length; i++) {
data.images[i] && data.images[i].url && arr.push( data.images[i].url);
}
} 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'); Common.component.Analytics.trackEvent('ToolBar', 'Image');
} }
}, },

View file

@ -36,7 +36,7 @@ class AddImageController extends Component {
if ((/((^https?)|(^ftp)):\/\/.+/i.test(_value))) { if ((/((^https?)|(^ftp)):\/\/.+/i.test(_value))) {
this.closeModal(); this.closeModal();
const api = Common.EditorApi.get(); const api = Common.EditorApi.get();
api.asc_addImageDrawingObject(_value); api.asc_addImageDrawingObject([_value]);
} else { } else {
f7.dialog.alert(_t.txtNotUrl, _t.notcriticalErrorTitle); f7.dialog.alert(_t.txtNotUrl, _t.notcriticalErrorTitle);
} }