refactoring. send commands to desktop app
This commit is contained in:
parent
b5a5c97735
commit
753afc350d
|
@ -55,7 +55,12 @@
|
|||
height: '100%',
|
||||
documentType: urlParams['doctype'] || 'text',
|
||||
document: doc,
|
||||
editorConfig: cfg
|
||||
editorConfig: cfg,
|
||||
events: {
|
||||
onInternalMessage: onInternalMessage,
|
||||
onDocumentReady: onDocumentReady
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
@ -92,7 +97,7 @@
|
|||
function getEditorConfig(urlParams) {
|
||||
return {
|
||||
customization : {
|
||||
goback: { url:"https://onlyoffice.com" }
|
||||
goback: { url: "callback" }
|
||||
},
|
||||
mode : urlParams["mode"] || 'edit',
|
||||
lang : urlParams["lang"] || 'en',
|
||||
|
@ -147,6 +152,21 @@
|
|||
}
|
||||
};
|
||||
|
||||
function onInternalMessage(event) {
|
||||
let info = event.data;
|
||||
if ( info.type == 'goback' ) {
|
||||
if ( window.AscDesktopEditor ) {
|
||||
window.AscDesktopEditor.execCommand('go:folder', info.data.status);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function onDocumentReady() {
|
||||
if ( window.AscDesktopEditor ) {
|
||||
window.AscDesktopEditor.execCommand('doc:onready', '');
|
||||
}
|
||||
}
|
||||
|
||||
if (isMobile()){
|
||||
window.addEventListener('load', fixSize);
|
||||
window.addEventListener('resize', fixSize);
|
||||
|
|
|
@ -582,12 +582,18 @@ define([
|
|||
},
|
||||
|
||||
goBack: function(blank) {
|
||||
var me = this;
|
||||
if ( me.appOptions.customization.goback.url == 'callback' ) {
|
||||
Common.Gateway.internalMessage( 'goback',
|
||||
{status: me.appOptions.isOffline ? 'offline' : 'online'} );
|
||||
} else {
|
||||
var href = this.appOptions.customization.goback.url;
|
||||
if (blank) {
|
||||
window.open(href, "_blank");
|
||||
} else {
|
||||
parent.location.href = href;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
onEditComplete: function(cmp) {
|
||||
|
|
|
@ -393,12 +393,18 @@ define([
|
|||
},
|
||||
|
||||
goBack: function(blank) {
|
||||
var href = this.appOptions.customization.goback.url;
|
||||
var me = this;
|
||||
if ( me.appOptions.customization.goback.url == 'callback' ) {
|
||||
Common.Gateway.internalMessage( 'goback',
|
||||
{status: me.appOptions.isOffline ? 'offline' : 'online'} );
|
||||
} else {
|
||||
var href = me.appOptions.customization.goback.url;
|
||||
if (blank) {
|
||||
window.open(href, "_blank");
|
||||
} else {
|
||||
parent.location.href = href;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
onEditComplete: function(cmp) {
|
||||
|
|
|
@ -428,12 +428,18 @@ define([
|
|||
},
|
||||
|
||||
goBack: function(blank) {
|
||||
var href = this.appOptions.customization.goback.url;
|
||||
var me = this;
|
||||
if ( me.appOptions.customization.goback.url == 'callback' ) {
|
||||
Common.Gateway.internalMessage( 'goback',
|
||||
{status: me.appOptions.isOffline ? 'offline' : 'online'} );
|
||||
} else {
|
||||
var href = me.appOptions.customization.goback.url;
|
||||
if (blank) {
|
||||
window.open(href, "_blank");
|
||||
} else {
|
||||
parent.location.href = href;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
onEditComplete: function(cmp, opts) {
|
||||
|
|
Loading…
Reference in a new issue