diff --git a/.github/workflows/artifact.yml b/.github/workflows/artifact.yml index 2b042348..8323c96b 100644 --- a/.github/workflows/artifact.yml +++ b/.github/workflows/artifact.yml @@ -31,8 +31,10 @@ jobs: cd onlyoffice rm -rf ./.github/ rm -rf ./.git/ + rm ./.eslintrc.js rm ./.gitignore rm ./.gitmodules + rm ./.stylelintrc.json rm -rf ./node_modules/ rm -rf ./src/ rm ./package.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f1c0001..83ec533a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Change Log +## 9.5.0 +## Added +- default empty templates +- Finnish, Hebrew, Norwegian, Slovenian empty file templates + +## Changed +- demo server address changed +- editing pdf by default + ## 9.4.0 ## Added - support tiff format for inserting diff --git a/appinfo/info.xml b/appinfo/info.xml index 532449cf..b666c566 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -6,7 +6,7 @@ ONLYOFFICE connector allows you to view, edit and collaborate on text documents, spreadsheets and presentations within Nextcloud using ONLYOFFICE Docs. This will create a new Edit in ONLYOFFICE action within the document library for Office documents. This allows multiple users to co-author documents in real time from the familiar web interface and save the changes back to your file storage. agpl Ascensio System SIA - 9.4.0 + 9.5.0 Onlyoffice diff --git a/assets/document-templates b/assets/document-templates index dc3f298d..26da8649 160000 --- a/assets/document-templates +++ b/assets/document-templates @@ -1 +1 @@ -Subproject commit dc3f298ddb8932e385cf81563dd4d2c9429d59e2 +Subproject commit 26da864937e48e80ee667e3545e386405c16c10f diff --git a/css/viewer.css b/css/viewer.css index 25b0b060..a82afc35 100644 --- a/css/viewer.css +++ b/css/viewer.css @@ -39,3 +39,9 @@ .modal-wrapper--full #onlyofficeViewerFrame { top: 0; } + +.widget-custom #onlyofficeViewerFrame { + position: unset; + top: unset; + min-height: 300px; +} \ No newline at end of file diff --git a/lib/AppConfig.php b/lib/AppConfig.php index 4528f9fe..7e3e9a58 100644 --- a/lib/AppConfig.php +++ b/lib/AppConfig.php @@ -1473,7 +1473,7 @@ public function getMimeType($ext) { * DEMO DATA */ private $DEMO_PARAM = [ - "ADDR" => "https://onlinedocs.onlyoffice.com/", + "ADDR" => "https://onlinedocs.docs.onlyoffice.com/", "HEADER" => "AuthorizationJWT", "SECRET" => "sn2puSUF7muF5Jas", "TRIAL" => 30 diff --git a/lib/Controller/CallbackController.php b/lib/Controller/CallbackController.php index 7fc7bc16..1ca4966c 100644 --- a/lib/Controller/CallbackController.php +++ b/lib/Controller/CallbackController.php @@ -383,7 +383,7 @@ public function emptyfile($doc) { } } - $templatePath = TemplateManager::getEmptyTemplatePath("en", ".docx"); + $templatePath = TemplateManager::getEmptyTemplatePath("default", ".docx"); $template = file_get_contents($templatePath); if (!$template) { diff --git a/lib/Controller/EditorApiController.php b/lib/Controller/EditorApiController.php index 388eeae4..81f25048 100644 --- a/lib/Controller/EditorApiController.php +++ b/lib/Controller/EditorApiController.php @@ -238,14 +238,13 @@ public function __construct( * @param string $guestName - nickname not logged user * @param bool $template - file is template * @param string $anchor - anchor for file content - * @param bool $forceEdit - open editing * * @return JSONResponse * * @NoAdminRequired * @PublicPage */ - public function config($fileId, $filePath = null, $shareToken = null, $directToken = null, $inframe = false, $inviewer = false, $desktop = false, $guestName = null, $template = false, $anchor = null, $forceEdit = false) { + public function config($fileId, $filePath = null, $shareToken = null, $directToken = null, $inframe = false, $inviewer = false, $desktop = false, $guestName = null, $template = false, $anchor = null) { if (!empty($directToken)) { list($directData, $error) = $this->crypt->readHash($directToken); @@ -409,7 +408,7 @@ public function config($fileId, $filePath = null, $shareToken = null, $directTok && !$isTempLock && (empty($shareToken) || ($share->getPermissions() & Constants::PERMISSION_UPDATE) === Constants::PERMISSION_UPDATE) && !$restrictedEditing; - $params["document"]["permissions"]["edit"] = $editable && ($forceEdit || !$canFillForms); + $params["document"]["permissions"]["edit"] = $editable; if (($editable || $restrictedEditing) && ($canEdit || $canFillForms)) { $ownerId = null; $owner = $file->getOwner(); diff --git a/lib/Controller/EditorController.php b/lib/Controller/EditorController.php index ff4f9345..7a29b9b4 100644 --- a/lib/Controller/EditorController.php +++ b/lib/Controller/EditorController.php @@ -433,7 +433,7 @@ public function users($fileId, $operationType = null) { if ($user->getUID() != $currentUserId && (!empty($email) || $operationType === "protect")) { $userElement = [ "name" => $user->getDisplayName(), - "id" => $user->getUID() + "id" => $operationType === "protect" ? $this->buildUserId($user->getUID()) : $user->getUID() ]; if (!empty($email)) { $userElement["email"] = $email; @@ -1283,7 +1283,6 @@ public function download($fileId, $toExtension = null, $template = false) { * @param string $filePath - file path * @param string $shareToken - access token * @param bool $inframe - open in frame - * @param bool $forceEdit - open editing * @param bool $inviewer - open in viewer * @param bool $template - file is template * @param string $anchor - anchor for file content @@ -1293,7 +1292,7 @@ public function download($fileId, $toExtension = null, $template = false) { * @NoAdminRequired * @NoCSRFRequired */ - public function index($fileId, $filePath = null, $shareToken = null, $inframe = false, $forceEdit = false, $inviewer = false, $template = false, $anchor = null) { + public function index($fileId, $filePath = null, $shareToken = null, $inframe = false, $inviewer = false, $template = false, $anchor = null) { $this->logger->debug("Open: $fileId $filePath ", ["app" => $this->appName]); $isLoggedIn = $this->userSession->isLoggedIn(); @@ -1332,8 +1331,7 @@ public function index($fileId, $filePath = null, $shareToken = null, $inframe = "isTemplate" => $template, "inframe" => false, "inviewer" => $inviewer === true, - "anchor" => $anchor, - "forceEdit" => $forceEdit + "anchor" => $anchor ]; $response = null; @@ -1374,7 +1372,6 @@ public function index($fileId, $filePath = null, $shareToken = null, $inframe = * @param integer $fileId - file identifier * @param string $shareToken - access token * @param bool $inframe - open in frame - * @param bool $forceEdit - open editing * * @return TemplateResponse * @@ -1382,8 +1379,8 @@ public function index($fileId, $filePath = null, $shareToken = null, $inframe = * @NoCSRFRequired * @PublicPage */ - public function publicPage($fileId, $shareToken, $inframe = false, $forceEdit = false) { - return $this->index($fileId, null, $shareToken, $inframe, $forceEdit); + public function publicPage($fileId, $shareToken, $inframe = false) { + return $this->index($fileId, null, $shareToken, $inframe); } /** diff --git a/lib/DirectEditor.php b/lib/DirectEditor.php index 686d846e..0fa91197 100644 --- a/lib/DirectEditor.php +++ b/lib/DirectEditor.php @@ -250,8 +250,7 @@ public function open(IToken $token): Response { "isTemplate" => false, "inframe" => false, "inviewer" => false, - "anchor" => null, - "forceEdit" => false + "anchor" => null ]; $response = new TemplateResponse($this->appName, "editor", $params, "base"); diff --git a/lib/TemplateManager.php b/lib/TemplateManager.php index 0dea5847..e164efdc 100644 --- a/lib/TemplateManager.php +++ b/lib/TemplateManager.php @@ -230,7 +230,7 @@ public static function getEmptyTemplate($name) { */ public static function getEmptyTemplatePath($lang, $ext) { if (!array_key_exists($lang, self::$localPath)) { - $lang = "en"; + $lang = "default"; } return dirname(__DIR__) . DIRECTORY_SEPARATOR . "assets" . DIRECTORY_SEPARATOR . "document-templates" . DIRECTORY_SEPARATOR . self::$localPath[$lang] . DIRECTORY_SEPARATOR . "new" . $ext; @@ -248,17 +248,21 @@ public static function getEmptyTemplatePath($lang, $ext) { "cs" => "cs-CZ", "de" => "de-DE", "de_DE" => "de-DE", + "default" => "default", "el" => "el-GR", "en" => "en-US", "en_GB" => "en-GB", "es" => "es-ES", "eu" => "eu-ES", + "fi" => "fi-FI", "fr" => "fr-FR", "gl" => "gl-ES", + "he" => "he-IL", "it" => "it-IT", "ja" => "ja-JP", "ko" => "ko-KR", "lv" => "lv-LV", + "nb" => "nb-NO", "nl" => "nl-NL", "pl" => "pl-PL", "pt_BR" => "pt-BR", @@ -266,6 +270,7 @@ public static function getEmptyTemplatePath($lang, $ext) { "ru" => "ru-RU", "si" => "si-LK", "sk" => "sk-SK", + "sl" => "sl-SI", "sr" => "sr-Latn-RS", "sv" => "sv-SE", "tr" => "tr-TR", diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index da2dc524..9d98e598 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1,12 +1,12 @@ { "name": "onlyoffice", - "version": "9.4.0", + "version": "9.5.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "onlyoffice", - "version": "9.4.0", + "version": "9.5.0", "license": "AGPL-3.0", "dependencies": { "@nextcloud/event-bus": "^3.3.1", diff --git a/package.json b/package.json index 8599c213..e1c4461b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "onlyoffice", "description": "ONLYOFFICE connector allows you to view, edit and collaborate on text documents, spreadsheets and presentations within Nextcloud using ONLYOFFICE Docs. This will create a new Edit in ONLYOFFICE action within the document library for Office documents. This allows multiple users to co-author documents in real time from the familiar web interface and save the changes back to your file storage.", - "version": "9.4.0", + "version": "9.5.0", "author": "Ascensio System SIA (https://www.onlyoffice.com)", "license": "AGPL-3.0", "homepage": "https://www.onlyoffice.com", diff --git a/src/editor.js b/src/editor.js index a9f81777..24e1f32b 100644 --- a/src/editor.js +++ b/src/editor.js @@ -53,7 +53,6 @@ OCA.Onlyoffice.inviewer = !!$('#iframeEditor').data('inviewer') OCA.Onlyoffice.filePath = $('#iframeEditor').data('path') OCA.Onlyoffice.anchor = $('#iframeEditor').attr('data-anchor') - OCA.Onlyoffice.forceEdit = $('#iframeEditor').attr('data-forceEdit') const guestName = localStorage.getItem('nick') OCA.Onlyoffice.currentWindow = window OCA.Onlyoffice.currentUser = OC.getCurrentUser() @@ -105,9 +104,6 @@ if (OCA.Onlyoffice.anchor) { params.push('anchor=' + encodeURIComponent(OCA.Onlyoffice.anchor)) } - if (OCA.Onlyoffice.forceEdit) { - params.push('forceEdit=true') - } if (OCA.Onlyoffice.inframe || directToken) { params.push('inframe=true') @@ -217,12 +213,6 @@ config.events.onRequestSharingSettings = OCA.Onlyoffice.onRequestSharingSettings } - if (!config.document.permissions.edit - && config.document.permissions.fillForms - && config.canEdit) { - config.events.onRequestEditRights = OCA.Onlyoffice.onRequestEditRights - } - OCA.Onlyoffice.docEditor = new DocsAPI.DocEditor('iframeEditor', config) if (OCA.Onlyoffice.directEditor) { @@ -249,17 +239,6 @@ }) } - OCA.Onlyoffice.onRequestEditRights = function() { - if (OCA.Onlyoffice.inframe) { - window.parent.postMessage({ - method: 'onRequestEditRights', - }, - '*') - return - } - location.href += '&forceEdit=true' - } - OCA.Onlyoffice.onRequestHistory = function(version) { $.get(OC.generateUrl('apps/' + OCA.Onlyoffice.AppName + '/ajax/history?fileId={fileId}', { diff --git a/src/listener.js b/src/listener.js index 4d64ad8f..9bc5b58d 100644 --- a/src/listener.js +++ b/src/listener.js @@ -128,10 +128,6 @@ } } - OCA.Onlyoffice.onRequestEditRights = function() { - $(OCA.Onlyoffice.frameSelector).attr('src', $(OCA.Onlyoffice.frameSelector).attr('src') + '&forceEdit=true') - } - window.addEventListener('message', function(event) { if (!$(OCA.Onlyoffice.frameSelector).length || $(OCA.Onlyoffice.frameSelector)[0].contentWindow !== event.source @@ -176,8 +172,6 @@ case 'onShowMessage': OCA.Onlyoffice.onShowMessage(event.data.param) break - case 'onRequestEditRights': - OCA.Onlyoffice.onRequestEditRights() } }, false) diff --git a/src/main.js b/src/main.js index 56a7478c..3874a8b9 100644 --- a/src/main.js +++ b/src/main.js @@ -124,9 +124,7 @@ import NewPdfSvg from '!!raw-loader!../img/new-pdf.svg'; if (open) { const fileName = response.name - const extension = OCA.Onlyoffice.getFileExtension(fileName) - const forceEdit = OCA.Onlyoffice.setting.formats[extension].fillForms - OCA.Onlyoffice.OpenEditor(response.id, dir, fileName, winEditor, forceEdit) + OCA.Onlyoffice.OpenEditor(response.id, dir, fileName, winEditor) OCA.Onlyoffice.context = { fileName: response.name, @@ -139,7 +137,7 @@ import NewPdfSvg from '!!raw-loader!../img/new-pdf.svg'; ) } - OCA.Onlyoffice.OpenEditor = function(fileId, fileDir, fileName, winEditor, forceEdit) { + OCA.Onlyoffice.OpenEditor = function(fileId, fileDir, fileName, winEditor) { let filePath = '' if (fileName) { filePath = fileDir.replace(/\/$/, '') + '/' + fileName @@ -158,10 +156,6 @@ import NewPdfSvg from '!!raw-loader!../img/new-pdf.svg'; }) } - if (forceEdit) { - url += '&forceEdit=true' - } - if (winEditor && winEditor.location) { winEditor.location.href = url } else if (!OCA.Onlyoffice.setting.sameTab || OCA.Onlyoffice.mobile || OCA.Onlyoffice.Desktop) { @@ -196,7 +190,8 @@ import NewPdfSvg from '!!raw-loader!../img/new-pdf.svg'; OCA.Onlyoffice.context = null - const url = OCA.Onlyoffice.folderUrl + let url = OCA.Onlyoffice.folderUrl + url = url.replace(/&?openfile=true/, '') if (url) { window.history.pushState(null, null, url) OCA.Onlyoffice.folderUrl = null diff --git a/templates/editor.php b/templates/editor.php index 052291b9..b356f94c 100644 --- a/templates/editor.php +++ b/templates/editor.php @@ -48,8 +48,7 @@ class="onlyoffice-inviewer" data-template="" data-anchor="" data-inframe="" - data-inviewer="" - data-forceedit=""> + data-inviewer="">