Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add toggle for editor line length per user #6569

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/Controller/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@

class SettingsController extends Controller {
public const ACCEPTED_KEYS = [
'workspace_enabled'
'workspace_enabled',
'is_full_width_editor'
];

public function __construct(
Expand All @@ -31,7 +32,7 @@ public function __construct(
/**
* @throws \OCP\PreConditionNotMetException
*
* @psalm-return DataResponse<200|400, array{workspace_enabled?: mixed, message?: 'Invalid config key'}, array<never, never>>
* @psalm-return DataResponse<200|400, array{workspace_enabled?: mixed, is_full_width_editor?: mixed, message?: 'Invalid config key'}, array<never, never>>
*/
#[NoAdminRequired]
public function updateConfig(string $key, int|string $value): DataResponse {
Expand Down
4 changes: 4 additions & 0 deletions lib/Service/ConfigService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
}
5 changes: 5 additions & 0 deletions lib/Service/InitialStateProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading
Loading