feat: get editor icons and their colors from snjs (#828)
* feat: get editor icons and their colors from snjs * feat: get icons and their tints from snjs * fix: use IconType from snjs
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import { Dropdown, DropdownItem } from '@/components/Dropdown';
|
||||
import { IconType } from '@/components/Icon';
|
||||
import { FeatureIdentifier, PrefKey } from '@standardnotes/snjs';
|
||||
import {
|
||||
PreferencesGroup,
|
||||
@@ -27,31 +26,6 @@ type EditorOption = DropdownItem & {
|
||||
value: FeatureIdentifier | 'plain-editor';
|
||||
};
|
||||
|
||||
export const getIconAndTintForEditor = (
|
||||
identifier: FeatureIdentifier | undefined
|
||||
): [IconType, number] => {
|
||||
switch (identifier) {
|
||||
case FeatureIdentifier.BoldEditor:
|
||||
case FeatureIdentifier.PlusEditor:
|
||||
return ['rich-text', 1];
|
||||
case FeatureIdentifier.MarkdownBasicEditor:
|
||||
case FeatureIdentifier.MarkdownMathEditor:
|
||||
case FeatureIdentifier.MarkdownMinimistEditor:
|
||||
case FeatureIdentifier.MarkdownProEditor:
|
||||
return ['markdown', 2];
|
||||
case FeatureIdentifier.TokenVaultEditor:
|
||||
return ['authenticator', 6];
|
||||
case FeatureIdentifier.SheetsEditor:
|
||||
return ['spreadsheets', 5];
|
||||
case FeatureIdentifier.TaskEditor:
|
||||
return ['tasks', 3];
|
||||
case FeatureIdentifier.CodeEditor:
|
||||
return ['code', 4];
|
||||
default:
|
||||
return ['plain-text', 1];
|
||||
}
|
||||
};
|
||||
|
||||
const makeEditorDefault = (
|
||||
application: WebApplication,
|
||||
component: SNComponent,
|
||||
@@ -103,7 +77,8 @@ export const Defaults: FunctionComponent<Props> = ({ application }) => {
|
||||
.componentsForArea(ComponentArea.Editor)
|
||||
.map((editor): EditorOption => {
|
||||
const identifier = editor.package_info.identifier;
|
||||
const [iconType, tint] = getIconAndTintForEditor(identifier);
|
||||
const [iconType, tint] =
|
||||
application.iconsController.getIconAndTintForEditor(identifier);
|
||||
|
||||
return {
|
||||
label: editor.name,
|
||||
|
||||
Reference in New Issue
Block a user