diff --git a/lib/Controller/SettingsController.php b/lib/Controller/SettingsController.php index 2a031a4b808..5651ce13315 100644 --- a/lib/Controller/SettingsController.php +++ b/lib/Controller/SettingsController.php @@ -16,7 +16,8 @@ class SettingsController extends Controller { public const ACCEPTED_KEYS = [ - 'workspace_enabled' + 'workspace_enabled', + 'is_full_width_editor' ]; public function __construct( @@ -31,7 +32,7 @@ public function __construct( /** * @throws \OCP\PreConditionNotMetException * - * @psalm-return DataResponse<200|400, array{workspace_enabled?: mixed, message?: 'Invalid config key'}, array> + * @psalm-return DataResponse<200|400, array{workspace_enabled?: mixed, is_full_width_editor?: mixed, message?: 'Invalid config key'}, array> */ #[NoAdminRequired] public function updateConfig(string $key, int|string $value): DataResponse { diff --git a/lib/Service/ConfigService.php b/lib/Service/ConfigService.php index 0fd85cb8f80..da3af31a768 100644 --- a/lib/Service/ConfigService.php +++ b/lib/Service/ConfigService.php @@ -44,4 +44,8 @@ public function isNotifyPushSyncEnabled(): bool { return $this->appConfig->getValueBool(Application::APP_NAME, 'notify_push'); } + + public function isFullWidthEditor(?string $userId): bool { + return $this->config->getUserValue($userId, Application::APP_NAME, 'is_full_width_editor', '0') === '1'; + } } diff --git a/lib/Service/InitialStateProvider.php b/lib/Service/InitialStateProvider.php index c88ea4a1958..f8138f03574 100644 --- a/lib/Service/InitialStateProvider.php +++ b/lib/Service/InitialStateProvider.php @@ -77,6 +77,11 @@ public function provideState(): void { 'notify_push', $this->configService->isNotifyPushSyncEnabled(), ); + + $this->initialState->provideInitialState( + 'is_full_width_editor', + $this->configService->isFullWidthEditor($this->userId), + ); } public function provideFileId(int $fileId): void { diff --git a/src/components/Editor.vue b/src/components/Editor.vue index fc81550499e..efa6d2f981c 100644 --- a/src/components/Editor.vue +++ b/src/components/Editor.vue @@ -48,7 +48,8 @@ :dirty="dirty" :sessions="filteredSessions" :sync-error="syncError" - :has-connection-issue="hasConnectionIssue" /> + :has-connection-issue="hasConnectionIssue" + @editor-width-change="handleEditorWidthChange" /> - +

{{ t('text', 'Last saved') }}: {{ lastSavedString }}

@@ -72,7 +73,9 @@ export default { }, sessions: { type: Object, - default: () => { return {} }, + default: () => { + return {} + }, }, }, @@ -128,35 +131,38 @@ export default { this.$syncService.forceSave() } }, + onEditorWidthChange(newWidth) { + this.$emit('editor-width-change', newWidth) + }, }, }