diff --git a/apps/api/documents/index.html.desktop b/apps/api/documents/index.html.desktop index 3b6a293bd..03edba6c1 100644 --- a/apps/api/documents/index.html.desktop +++ b/apps/api/documents/index.html.desktop @@ -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); diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 173cce5c6..e167c20db 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -582,11 +582,17 @@ define([ }, goBack: function(blank) { - var href = this.appOptions.customization.goback.url; - if (blank) { - window.open(href, "_blank"); + var me = this; + if ( me.appOptions.customization.goback.url == 'callback' ) { + Common.Gateway.internalMessage( 'goback', + {status: me.appOptions.isOffline ? 'offline' : 'online'} ); } else { - parent.location.href = href; + var href = this.appOptions.customization.goback.url; + if (blank) { + window.open(href, "_blank"); + } else { + parent.location.href = href; + } } }, diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index c1c12a7f6..56a972c43 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -393,12 +393,18 @@ define([ }, goBack: function(blank) { - var href = this.appOptions.customization.goback.url; - if (blank) { - window.open(href, "_blank"); - } else { - parent.location.href = href; - } + 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) { diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 3fd553372..23444269e 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -428,11 +428,17 @@ define([ }, goBack: function(blank) { - var href = this.appOptions.customization.goback.url; - if (blank) { - window.open(href, "_blank"); + var me = this; + if ( me.appOptions.customization.goback.url == 'callback' ) { + Common.Gateway.internalMessage( 'goback', + {status: me.appOptions.isOffline ? 'offline' : 'online'} ); } else { - parent.location.href = href; + var href = me.appOptions.customization.goback.url; + if (blank) { + window.open(href, "_blank"); + } else { + parent.location.href = href; + } } },