feat: Add setting for rich mode and make markdown the default

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2023-02-24 10:28:11 +01:00
parent a84387c69b
commit 54669f13a1
3 changed files with 6 additions and 5 deletions

View File

@ -18,7 +18,7 @@ class SettingsService {
/* Allowed attributes */
private array $attrs;
private $defaultSuffixes = [ '.txt', '.md' ];
private $defaultSuffixes = [ '.md', '.txt' ];
public function __construct(
IConfig $config,
@ -48,7 +48,7 @@ class SettingsService {
return implode(DIRECTORY_SEPARATOR, $path);
},
],
'noteMode' => $this->getListAttrs('noteMode', ['edit', 'preview']),
'noteMode' => $this->getListAttrs('noteMode', ['rich', 'edit', 'preview']),
'customSuffix' => [
'default' => $this->defaultSuffixes[0],
'validate' => function ($value) {

View File

@ -63,11 +63,12 @@ export default {
data() {
return {
extensions: [
{ value: '.txt', label: '.txt' },
{ value: '.md', label: '.md' },
{ value: '.txt', label: '.txt' },
{ value: 'custom', label: t('notes', 'User defined') },
],
noteModes: [
{ value: 'rich', label: t('notes', 'Open in rich text mode') },
{ value: 'edit', label: t('notes', 'Open in edit mode') },
{ value: 'preview', label: t('notes', 'Open in preview mode') },
],

View File

@ -195,14 +195,14 @@ class APIv1Test extends CommonAPITest {
$this->updateSettings($settings, (object)[
'fileSuffix' => '',
], (object)[
'fileSuffix' => '.txt',
'fileSuffix' => '.md',
], 'Update fileSuffix with empty value');
$this->updateSettings($settings, (object)[
'notesPath' => null,
'fileSuffix' => null,
], (object)[
'notesPath' => 'Notes',
'fileSuffix' => '.txt',
'fileSuffix' => '.md',
], 'Update settings with default values');
$this->updateSettings($settings, (object)[
'notesPath' => $originalPath,