From 18a6409fdb6cfaa072d0540ef85651227a048bd2 Mon Sep 17 00:00:00 2001 From: Sergey Linnik Date: Thu, 31 Oct 2019 11:04:12 +0300 Subject: [PATCH 01/42] Use iframe for displaying the editor inline (#154) --- controller/editorcontroller.php | 6 +++++- css/editor.css | 5 +++++ css/main.css | 10 ++++++++++ js/main.js | 13 ++++++++++++- 4 files changed, 32 insertions(+), 2 deletions(-) diff --git a/controller/editorcontroller.php b/controller/editorcontroller.php index 9a866bf1..42ef5235 100644 --- a/controller/editorcontroller.php +++ b/controller/editorcontroller.php @@ -510,7 +510,11 @@ public function index($fileId, $shareToken = NULL, $filePath = NULL) { "shareToken" => $shareToken ]; - $response = new TemplateResponse($this->appName, "editor", $params); + if ($this->config->GetSameTab() && empty($shareToken)) { + $response = new TemplateResponse($this->appName, "editor", $params, "plain"); + } else { + $response = new TemplateResponse($this->appName, "editor", $params); + } $csp = new ContentSecurityPolicy(); $csp->allowInlineScript(true); diff --git a/css/editor.css b/css/editor.css index 7cfebd32..01dc090e 100644 --- a/css/editor.css +++ b/css/editor.css @@ -29,6 +29,11 @@ #content.app-onlyoffice { min-height: calc(100% - 50px); } + +#body-public #content { + height: 100%; +} + #app > iframe { position: absolute; vertical-align: top; diff --git a/css/main.css b/css/main.css index 513c9a8d..68fab2a5 100644 --- a/css/main.css +++ b/css/main.css @@ -40,6 +40,16 @@ background-image: url("../img/app-dark.svg"); } +#onlyofficeFrame { + background-color: #fff; + width: 100%; + height: calc(100vh - 50px); + display: block; + position: absolute; + top: 0; + z-index: 110; +} + .AscDesktopEditor #body-user #header { display: none; } diff --git a/js/main.js b/js/main.js index 5bd4d3e4..4d7ed95d 100644 --- a/js/main.js +++ b/js/main.js @@ -98,8 +98,19 @@ winEditor.location.href = url; } else if (!OCA.Onlyoffice.setting.sameTab || OCA.Onlyoffice.Desktop) { winEditor = window.open(url, "_blank"); - } else { + } else if ($("#isPublic").val()) { location.href = url; + } else { + var $iframe = $("