diff --git a/lib/Controller/SettingsController.php b/lib/Controller/SettingsController.php index 2c1ca955093..c93c92d0379 100644 --- a/lib/Controller/SettingsController.php +++ b/lib/Controller/SettingsController.php @@ -18,7 +18,7 @@ class SettingsController extends Controller { public const ACCEPTED_KEYS = [ 'workspace_enabled', - 'user_text_editor_max_width' + 'is_full_width_editor' ]; public function __construct( @@ -34,7 +34,7 @@ public function __construct( /** * @throws \OCP\PreConditionNotMetException * - * @psalm-return DataResponse<200|400, array{workspace_enabled?: mixed, user_text_editor_max_width?: 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 1b6564eef94..74fb1fe9551 100644 --- a/lib/Service/ConfigService.php +++ b/lib/Service/ConfigService.php @@ -52,8 +52,8 @@ public function isNotifyPushSyncEnabled(): bool } - public function getUserPreferencesTextEditorMaxWidth(?string $userId): string + public function isFullWidthEditor(?string $userId): bool { - return $this->config->getUserValue($userId, Application::APP_NAME, 'user_text_editor_max_width', '80ch'); + 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 de1d286aadb..102e4bf6568 100644 --- a/lib/Service/InitialStateProvider.php +++ b/lib/Service/InitialStateProvider.php @@ -82,8 +82,8 @@ public function provideState(): void ); $this->initialState->provideInitialState( - 'user_text_editor_max_width', - $this->configService->getUserPreferencesTextEditorMaxWidth($this->userId), + 'is_full_width_editor', + $this->configService->isFullWidthEditor($this->userId), ); } diff --git a/src/components/Editor.vue b/src/components/Editor.vue index d86cf390755..372168c09df 100644 --- a/src/components/Editor.vue +++ b/src/components/Editor.vue @@ -321,7 +321,7 @@ export default { } }, editorMaxWidth() { - return loadState('text', 'user_text_editor_max_width', '80ch') + return loadState('text', 'is_full_width_editor', false) ? '100%' : '80ch' }, }, watch: { diff --git a/src/components/Editor/SessionList.vue b/src/components/Editor/SessionList.vue index 8f3718bfd92..c715106c750 100644 --- a/src/components/Editor/SessionList.vue +++ b/src/components/Editor/SessionList.vue @@ -70,11 +70,10 @@ export default { }, }, data() { - const savedWidth = loadState('text', 'user_text_editor_max_width', '80ch') + const isFullWidth = loadState('text', 'is_full_width_editor', false) return { myName: '', - user_text_editor_max_width: savedWidth, - isFullWidth: savedWidth === '100%', + isFullWidth, } }, computed: { @@ -112,15 +111,12 @@ export default { }, methods: { onWidthToggle(checked) { - const newWidth = checked ? '100%' : '80ch' - this.user_text_editor_max_width = newWidth this.isFullWidth = checked - - this.$emit('editor-width-change', newWidth) + this.$emit('editor-width-change', checked ? '100%' : '80ch') axios.post(generateUrl('/apps/text/settings'), { - key: 'user_text_editor_max_width', - value: newWidth, + key: 'is_full_width_editor', + value: checked ? '1' : '0', }) }, },