admin/fs: yaml format for masks field
Massimo Melina committed
Jan 18, 2023 at 23:39 UTC
d6e61f086c88a1dfb813c10ffa5dcb75bc1813ca
1 file changed
+5
-2
admin/src/FileForm.ts
+5
-2
@@ -11,6 +11,7 @@ import md from './md'
11
import _ from 'lodash'
12
import FileField from './FileField'
13
import { alertDialog } from './dialog'
14
+import yaml from 'yaml'
15
16
interface Account { username: string }
17
@@ -87,8 +88,10 @@ export default function FileForm({ file, defaultPerms }: { file: VfsNode, defaul
88
toField: Boolean, fromField: (v:boolean) => v ? 'index.html' : null,
89
helperText: md("This folder may be a website because contains `index.html`. Enabling this will show the website instead of the list of files.")
90
},
90
- isDir && { k: 'masks', multiline: true, xl: true, toField: JSON.stringify, fromField: v => v ? JSON.parse(v) : undefined,
91
- helperText: "This is a special field. Leave it empty unless you know what you are doing." }
91
+ isDir && { k: 'masks', multiline: true, xl: true,
92
+ toField: yaml.stringify, fromField: v => v ? yaml.parse(v) : undefined,
93
+ sx: { '& textarea': { fontFamily: 'monospace' } },
94
+ helperText: "Special field, leave empty unless you know what you are doing. YAML syntax." }
95
]
96
})
97