diff --git a/controller/editorapicontroller.php b/controller/editorapicontroller.php index 1703e032..c6dd0813 100644 --- a/controller/editorapicontroller.php +++ b/controller/editorapicontroller.php @@ -452,6 +452,12 @@ public function config($fileId, $filePath = null, $shareToken = null, $directTok $params["_file_path"] = $userFolder->getRelativePath($file->getPath()); } + if ($inframe === true) { + $params["_files_sharing"] = \OC::$server->getAppManager()->isInstalled("files_sharing"); + $params["editorConfig"]["customization"]["goback"]["requestClose"] = true; + $params["editorConfig"]["customization"]["goback"]["text"] = "Close"; + } + if ($folderLink !== null && $this->config->GetSystemValue($this->config->_customization_goback) !== false) { $params["editorConfig"]["customization"]["goback"] = [ @@ -469,10 +475,6 @@ public function config($fileId, $filePath = null, $shareToken = null, $directTok } } - if ($inframe === true) { - $params["_files_sharing"] = \OC::$server->getAppManager()->isInstalled("files_sharing"); - } - $params = $this->setCustomization($params); $params = $this->setWatermark($params, !empty($shareToken), $userId, $file); diff --git a/js/main.js b/js/main.js index 797a7677..0f656db4 100644 --- a/js/main.js +++ b/js/main.js @@ -536,21 +536,10 @@ var editorUrl = OC.generateUrl("apps/" + OCA.Onlyoffice.AppName + "/s/" + encodeURIComponent($("#sharingToken").val())); - if (_oc_appswebroots.richdocuments + if (! (_oc_appswebroots.richdocuments || _oc_appswebroots.files_pdfviewer && extension === "pdf" - || _oc_appswebroots.text && extension === "txt") { + || _oc_appswebroots.text && extension === "txt")) { - var button = document.createElement("a"); - button.href = editorUrl; - button.className = "onlyoffice-public-open button"; - button.innerText = t(OCA.Onlyoffice.AppName, "Open in ONLYOFFICE") - - if (!OCA.Onlyoffice.setting.sameTab) { - button.target = "_blank"; - } - - $("#preview").prepend(button); - } else { OCA.Onlyoffice.frameSelector = "#onlyofficeFrame"; var $iframe = $("