[Wopi] Support insert image from storage: EnableInsertRemoteImage from CheckFileInfo

This commit is contained in:
Julia Radzhabova 2021-08-27 13:22:08 +03:00
parent 0b10fb7a52
commit 0c0d9a06b2

View file

@ -102,6 +102,7 @@ div {
var sendNotificationTimer;
var sessionId;
var fileInfo;
var insertImageType;
var innerAlert = function (message) {
if (console && console.log)
@ -117,6 +118,12 @@ div {
innerAlert('Grab_Focus');
docEditor.grabFocus();
},
'Action_InsertGraphic': function (data) {
data && data.Values && docEditor.insertImage({
"c": insertImageType,
"images": [{ "url": data.Values.url }]
});
},
'Host_PostmessageReady': function (data) {
innerAlert('Host_PostmessageReady');
}
@ -226,6 +233,11 @@ div {
window.open(fileInfo.FileVersionUrl, "_blank");
};
var onRequestInsertImage = function (event) {
insertImageType = event.data.c;
_postMessage('UI_InsertGraphic', {});
};
var onError = function (event) {
if (event)
innerAlert(event.data);
@ -304,7 +316,8 @@ div {
"onRequestClose": fileInfo.ClosePostMessage || fileInfo.CloseUrl ? onRequestClose : undefined,
"onRequestRename": fileInfo.SupportsRename && fileInfo.UserCanRename ? onRequestRename : undefined,
"onRequestSharingSettings": fileInfo.FileSharingPostMessage || fileInfo.FileSharingUrl ? onRequestSharingSettings : undefined,
"onRequestHistory": fileInfo.FileVersionUrl || fileInfo.FileVersionPostMessage ? onRequestHistory : undefined
"onRequestHistory": fileInfo.FileVersionUrl || fileInfo.FileVersionPostMessage ? onRequestHistory : undefined,
"onRequestInsertImage": fileInfo.EnableInsertRemoteImage ? onRequestInsertImage : undefined
}
};