Skip to content

Commit 8d42e3c

Browse files
juliusknorrmejo-
authored andcommitted
chore: Add config lexicon
Signed-off-by: Julius Knorr <jus@bitgrid.net>
1 parent 7ef48d6 commit 8d42e3c

4 files changed

Lines changed: 90 additions & 0 deletions

File tree

composer/composer/autoload_classmap.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@
99
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
1010
'OCA\\Text\\AppInfo\\Application' => $baseDir . '/../lib/AppInfo/Application.php',
1111
'OCA\\Text\\Command\\ResetDocument' => $baseDir . '/../lib/Command/ResetDocument.php',
12+
<<<<<<< HEAD
1213
'OCA\\Text\\Controller\\AiController' => $baseDir . '/../lib/Controller/AiController.php',
14+
=======
15+
'OCA\\Text\\ConfigLexicon' => $baseDir . '/../lib/ConfigLexicon.php',
16+
>>>>>>> ba246c357 (chore: Add config lexicon)
1317
'OCA\\Text\\Controller\\AttachmentController' => $baseDir . '/../lib/Controller/AttachmentController.php',
1418
'OCA\\Text\\Controller\\ISessionAwareController' => $baseDir . '/../lib/Controller/ISessionAwareController.php',
1519
'OCA\\Text\\Controller\\NavigationController' => $baseDir . '/../lib/Controller/NavigationController.php',

composer/composer/autoload_static.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ class ComposerStaticInitText
2424
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
2525
'OCA\\Text\\AppInfo\\Application' => __DIR__ . '/..' . '/../lib/AppInfo/Application.php',
2626
'OCA\\Text\\Command\\ResetDocument' => __DIR__ . '/..' . '/../lib/Command/ResetDocument.php',
27+
<<<<<<< HEAD
2728
'OCA\\Text\\Controller\\AiController' => __DIR__ . '/..' . '/../lib/Controller/AiController.php',
29+
=======
30+
'OCA\\Text\\ConfigLexicon' => __DIR__ . '/..' . '/../lib/ConfigLexicon.php',
31+
>>>>>>> ba246c357 (chore: Add config lexicon)
2832
'OCA\\Text\\Controller\\AttachmentController' => __DIR__ . '/..' . '/../lib/Controller/AttachmentController.php',
2933
'OCA\\Text\\Controller\\ISessionAwareController' => __DIR__ . '/..' . '/../lib/Controller/ISessionAwareController.php',
3034
'OCA\\Text\\Controller\\NavigationController' => __DIR__ . '/..' . '/../lib/Controller/NavigationController.php',

lib/AppInfo/Application.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ public function __construct(array $params = []) {
5050
}
5151

5252
public function register(IRegistrationContext $context): void {
53+
$context->registerConfigLexicon(\OCA\Text\ConfigLexicon::class);
54+
5355
$context->registerEventListener(RegisterDirectEditorEvent::class, RegisterDirectEditorEventListener::class);
5456
$context->registerEventListener(LoadViewer::class, LoadViewerListener::class);
5557
$context->registerEventListener(LoadAdditionalScriptsEvent::class, FilesLoadAdditionalScriptsListener::class);

lib/ConfigLexicon.php

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
7+
* SPDX-License-Identifier: AGPL-3.0-or-later
8+
*/
9+
10+
namespace OCA\Text;
11+
12+
use OCP\Config\Lexicon\Entry;
13+
use OCP\Config\Lexicon\ILexicon;
14+
use OCP\Config\Lexicon\Strictness;
15+
use OCP\Config\ValueType;
16+
17+
class ConfigLexicon implements ILexicon {
18+
public function getStrictness(): Strictness {
19+
return Strictness::WARNING;
20+
}
21+
22+
public function getAppConfigs(): array {
23+
return [
24+
new Entry(
25+
key: 'default_file_extension',
26+
type: ValueType::STRING,
27+
defaultRaw: 'md',
28+
definition: 'Default file extension for new text files',
29+
lazy: false,
30+
),
31+
new Entry(
32+
key: 'open_read_only_enabled',
33+
type: ValueType::STRING,
34+
defaultRaw: '0',
35+
definition: 'Whether opening files in read-only mode is enabled',
36+
lazy: false,
37+
),
38+
new Entry(
39+
key: 'rich_editing_enabled',
40+
type: ValueType::STRING,
41+
defaultRaw: '1',
42+
definition: 'Whether rich editing is enabled',
43+
lazy: false,
44+
),
45+
new Entry(
46+
key: 'workspace_available',
47+
type: ValueType::STRING,
48+
defaultRaw: '1',
49+
definition: 'Whether rich workspace feature is available',
50+
lazy: false,
51+
),
52+
new Entry(
53+
key: 'notify_push',
54+
type: ValueType::BOOL,
55+
defaultRaw: true,
56+
definition: 'Whether notify_push synchronization is enabled',
57+
lazy: false,
58+
),
59+
];
60+
}
61+
62+
public function getUserConfigs(): array {
63+
return [
64+
new Entry(
65+
key: 'workspace_enabled',
66+
type: ValueType::BOOL,
67+
defaultRaw: true,
68+
definition: 'Whether rich workspace is enabled for the user',
69+
lazy: false,
70+
),
71+
new Entry(
72+
key: 'is_full_width_editor',
73+
type: ValueType::BOOL,
74+
defaultRaw: false,
75+
definition: 'Whether the editor should be displayed in full width mode',
76+
lazy: false,
77+
),
78+
];
79+
}
80+
}

0 commit comments

Comments
 (0)