mirror of
https://github.com/ONLYOFFICE/web-apps.git
synced 2026-07-25 03:05:54 +08:00
[DE PE SSE mobile] Fix Bug 61642
This commit is contained in:
@ -389,6 +389,7 @@ class MainController extends Component {
|
||||
Common.Gateway.on('downloadas', this.onDownloadAs.bind(this));
|
||||
Common.Gateway.on('requestclose', this.onRequestClose.bind(this));
|
||||
Common.Gateway.on('setfavorite', this.onSetFavorite.bind(this));
|
||||
Common.Gateway.on('insertimage', this.insertImage.bind(this));
|
||||
|
||||
Common.Gateway.sendInfo({
|
||||
mode: appOptions.isEdit ? 'edit' : 'view'
|
||||
@ -499,6 +500,30 @@ class MainController extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
insertImage (data) {
|
||||
if (data && (data.url || data.images)) {
|
||||
if (data.url) {
|
||||
console.log("Obsolete: The 'url' parameter of the 'insertImage' method is deprecated. Please use 'images' parameter instead.");
|
||||
}
|
||||
|
||||
let arr = [];
|
||||
|
||||
if (data.images && data.images.length > 0) {
|
||||
for (let i = 0; i < data.images.length; i++) {
|
||||
if (data.images[i] && data.images[i].url) {
|
||||
arr.push(data.images[i].url);
|
||||
}
|
||||
}
|
||||
} else if (data.url) {
|
||||
arr.push(data.url);
|
||||
}
|
||||
|
||||
data._urls = arr;
|
||||
}
|
||||
|
||||
Common.Notifications.trigger('storage:image-insert', data);
|
||||
}
|
||||
|
||||
loadDefaultMetricSettings() {
|
||||
const appOptions = this.props.storeAppOptions;
|
||||
let region = '';
|
||||
@ -932,6 +957,13 @@ class MainController extends Component {
|
||||
});
|
||||
|
||||
Common.Notifications.on('markfavorite', this.markFavorite.bind(this));
|
||||
Common.Notifications.on('storage:image-insert', this.insertImageFromStorage.bind(this));
|
||||
}
|
||||
|
||||
insertImageFromStorage(data) {
|
||||
if (data && data._urls && (!data.c || data.c === 'add') && data._urls.length > 0) {
|
||||
this.api.AddImageUrl(data._urls, undefined, data.token);
|
||||
}
|
||||
}
|
||||
|
||||
markFavorite(favorite) {
|
||||
|
||||
@ -519,6 +519,14 @@ class MainController extends Component {
|
||||
storePresentationInfo.changeTitle(meta.title);
|
||||
}
|
||||
});
|
||||
|
||||
Common.Notifications.on('storage:image-insert', this.insertImageFromStorage.bind(this));
|
||||
}
|
||||
|
||||
insertImageFromStorage(data) {
|
||||
if (data && data._urls && (!data.c || data.c === 'add') && data._urls.length > 0) {
|
||||
this.api.AddImageUrl(data._urls, undefined, data.token);
|
||||
}
|
||||
}
|
||||
|
||||
onApiTextReplaced(found, replaced) {
|
||||
@ -563,6 +571,7 @@ class MainController extends Component {
|
||||
Common.Gateway.on('processrightschange', this.onProcessRightsChange.bind(this));
|
||||
Common.Gateway.on('downloadas', this.onDownloadAs.bind(this));
|
||||
Common.Gateway.on('requestclose', this.onRequestClose.bind(this));
|
||||
Common.Gateway.on('insertimage', this.insertImage.bind(this));
|
||||
|
||||
Common.Gateway.sendInfo({
|
||||
mode: appOptions.isEdit ? 'edit' : 'view'
|
||||
@ -582,6 +591,30 @@ class MainController extends Component {
|
||||
appOptions.changeDocReady(true);
|
||||
}
|
||||
|
||||
insertImage (data) {
|
||||
if (data && (data.url || data.images)) {
|
||||
if (data.url) {
|
||||
console.log("Obsolete: The 'url' parameter of the 'insertImage' method is deprecated. Please use 'images' parameter instead.");
|
||||
}
|
||||
|
||||
let arr = [];
|
||||
|
||||
if (data.images && data.images.length > 0) {
|
||||
for (let i = 0; i < data.images.length; i++) {
|
||||
if (data.images[i] && data.images[i].url) {
|
||||
arr.push(data.images[i].url);
|
||||
}
|
||||
}
|
||||
} else if (data.url) {
|
||||
arr.push(data.url);
|
||||
}
|
||||
|
||||
data._urls = arr;
|
||||
}
|
||||
|
||||
Common.Notifications.trigger('storage:image-insert', data);
|
||||
}
|
||||
|
||||
onLicenseChanged (params) {
|
||||
const appOptions = this.props.storeAppOptions;
|
||||
const licType = params.asc_getLicenseType();
|
||||
|
||||
@ -440,6 +440,7 @@ class MainController extends Component {
|
||||
this.api.asc_registerCallback('asc_onEndAction', this._onLongActionEnd.bind(this));
|
||||
|
||||
Common.Notifications.on('download:cancel', this.onDownloadCancel.bind(this));
|
||||
Common.Notifications.on('storage:image-insert', this.insertImageFromStorage.bind(this));
|
||||
|
||||
EditorUIController.initCellInfo && EditorUIController.initCellInfo(this.props);
|
||||
|
||||
@ -585,6 +586,12 @@ class MainController extends Component {
|
||||
this.api.asc_setFilteringMode && this.api.asc_setFilteringMode(storeAppOptions.canModifyFilter);
|
||||
}
|
||||
|
||||
insertImageFromStorage (data) {
|
||||
if (data && data._urls && (!data.c || data.c === 'add') && data._urls.length > 0) {
|
||||
this.api.asc_addImageDrawingObject(data._urls, undefined, data.token);
|
||||
}
|
||||
}
|
||||
|
||||
onNeedUpdateExternalReference() {
|
||||
const { t } = this.props;
|
||||
|
||||
@ -732,6 +739,7 @@ class MainController extends Component {
|
||||
Common.Gateway.on('processrightschange', this.onProcessRightsChange.bind(this));
|
||||
Common.Gateway.on('downloadas', this.onDownloadAs.bind(this));
|
||||
Common.Gateway.on('requestclose', this.onRequestClose.bind(this));
|
||||
Common.Gateway.on('insertimage', this.insertImage.bind(this));
|
||||
|
||||
Common.Gateway.sendInfo({
|
||||
mode: appOptions.isEdit ? 'edit' : 'view'
|
||||
@ -750,6 +758,30 @@ class MainController extends Component {
|
||||
appOptions.changeDocReady(true);
|
||||
}
|
||||
|
||||
insertImage (data) {
|
||||
if (data && (data.url || data.images)) {
|
||||
if (data.url) {
|
||||
console.log("Obsolete: The 'url' parameter of the 'insertImage' method is deprecated. Please use 'images' parameter instead.");
|
||||
}
|
||||
|
||||
let arr = [];
|
||||
|
||||
if (data.images && data.images.length > 0) {
|
||||
for (let i = 0; i < data.images.length; i++) {
|
||||
if (data.images[i] && data.images[i].url) {
|
||||
arr.push(data.images[i].url);
|
||||
}
|
||||
}
|
||||
} else if (data.url) {
|
||||
arr.push(data.url);
|
||||
}
|
||||
|
||||
data._urls = arr;
|
||||
}
|
||||
|
||||
Common.Notifications.trigger('storage:image-insert', data);
|
||||
}
|
||||
|
||||
applyMode (appOptions) {
|
||||
this.api.asc_enableKeyEvents(appOptions.isEdit);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user