From 5570aa7b9126718abf9cc8bd871c171ebcb00528 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Wed, 21 Feb 2024 12:31:41 +0100 Subject: [PATCH] fix: Add config option to disable edit locally MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- lib/Service/InitialStateService.php | 2 ++ src/view/Office.vue | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/lib/Service/InitialStateService.php b/lib/Service/InitialStateService.php index 5bc657f447..6726a09dcf 100644 --- a/lib/Service/InitialStateService.php +++ b/lib/Service/InitialStateService.php @@ -105,5 +105,7 @@ private function provideOptions(): void { $this->initialState->provideInitialState('theming-customLogo', ($logoSet ? $this->urlGenerator->getAbsoluteURL($this->themingDefaults->getLogo()) : false)); + + $this->initialState->provideInitialState('open_local_editor', $this->config->getAppValue(Application::APPNAME, 'open_local_editor', 'yes') === 'yes'); } } diff --git a/src/view/Office.vue b/src/view/Office.vue index bb7275d037..578b875153 100644 --- a/src/view/Office.vue +++ b/src/view/Office.vue @@ -306,14 +306,16 @@ export default { this.loading = LOADING_STATE.DOCUMENT_READY clearTimeout(this.loadingTimeout) this.sendPostMessage('Host_PostmessageReady') - this.sendPostMessage('Insert_Button', { - id: 'Open_Local_Editor', - imgurl: window.location.protocol + '//' + getNextcloudUrl() + imagePath('richdocuments', 'launch.svg'), - mobile: false, - label: t('richdocuments', 'Open in local editor'), - hint: t('richdocuments', 'Open in local editor'), - insertBefore: 'print', - }) + if (loadState('richdocuments', 'open_local_editor', true)) { + this.sendPostMessage('Insert_Button', { + id: 'Open_Local_Editor', + imgurl: window.location.protocol + '//' + getNextcloudUrl() + imagePath('richdocuments', 'launch.svg'), + mobile: false, + label: t('richdocuments', 'Open in local editor'), + hint: t('richdocuments', 'Open in local editor'), + insertBefore: 'print', + }) + } }, async share() { FilesAppIntegration.share()