feat: Add "Appearance" pane to preferences (#816)

Co-authored-by: Mo <mo@standardnotes.com>
This commit is contained in:
Aman Harwara
2022-01-19 19:41:04 +05:30
committed by GitHub
parent c232a5e3c6
commit da1d4f75c8
11 changed files with 307 additions and 44 deletions

View File

@@ -84,7 +84,7 @@ const getDefaultEditor = (application: WebApplication) => {
export const Defaults: FunctionComponent<Props> = ({ application }) => {
const [editorItems, setEditorItems] = useState<DropdownItem[]>([]);
const [defaultEditorValue] = useState(
const [defaultEditorValue, setDefaultEditorValue] = useState(
() =>
getDefaultEditor(application)?.package_info?.identifier || 'plain-editor'
);
@@ -128,6 +128,7 @@ export const Defaults: FunctionComponent<Props> = ({ application }) => {
}, [application]);
const setDefaultEditor = (value: string) => {
setDefaultEditorValue(value as FeatureIdentifier);
const editors = application.componentManager.componentsForArea(
ComponentArea.Editor
);
@@ -155,7 +156,7 @@ export const Defaults: FunctionComponent<Props> = ({ application }) => {
id="def-editor-dropdown"
label="Select the default editor"
items={editorItems}
defaultValue={defaultEditorValue}
value={defaultEditorValue}
onChange={setDefaultEditor}
/>
</div>