refactor(Settings): Generate default file syntax options programatically
import { Component, h, State } from '@stencil/core'
+import { FileFormatUtils } from '@stencila/components'
import { i18n } from '../../../../i18n'
import { UnprotectedStoreKeys } from '../../../../preload/stores'
import { AppConfigStore } from '../../../../preload/types'
@@ -45,24 +46,15 @@ export class AppSettingsEditor {
UnprotectedStoreKeys.EDITOR_NEW_FILE_SYNTAX
)}
>
+ {Object.values(FileFormatUtils.fileFormatMap).map((format) => (
<option
- value="md"
- selected={this.config.EDITOR_NEW_FILE_SYNTAX === 'md'}
+ value={format.ext ?? format.name}
+ selected={this.config.EDITOR_NEW_FILE_SYNTAX === format.name}
+ key={format.name}
>
- Markdown
- </option>
- <option
- value="rmd"
- selected={this.config.EDITOR_NEW_FILE_SYNTAX === 'rmd'}
- >
- RMD
- </option>
- <option
- value="r"
- selected={this.config.EDITOR_NEW_FILE_SYNTAX === 'r'}
- >
- R
+ {format.name}
</option>
+ ))}
</select>
<p class="helpText">
