refactor: Use enum instead of string
This commit is contained in:
@@ -93,7 +93,8 @@ export const Defaults: FunctionComponent<Props> = ({ application }) => {
|
|||||||
const [editorItems, setEditorItems] = useState<DropdownItem[]>([]);
|
const [editorItems, setEditorItems] = useState<DropdownItem[]>([]);
|
||||||
const [defaultEditorValue] = useState(
|
const [defaultEditorValue] = useState(
|
||||||
() =>
|
() =>
|
||||||
getDefaultEditor(application)?.package_info?.identifier || 'plain-editor'
|
getDefaultEditor(application)?.package_info?.identifier ||
|
||||||
|
EditorIdentifier.PlainEditor
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -117,7 +118,7 @@ export const Defaults: FunctionComponent<Props> = ({ application }) => {
|
|||||||
{
|
{
|
||||||
icon: 'plain-text',
|
icon: 'plain-text',
|
||||||
label: 'Plain Editor',
|
label: 'Plain Editor',
|
||||||
value: 'plain-editor',
|
value: EditorIdentifier.PlainEditor,
|
||||||
},
|
},
|
||||||
...editors,
|
...editors,
|
||||||
]);
|
]);
|
||||||
@@ -129,7 +130,7 @@ export const Defaults: FunctionComponent<Props> = ({ application }) => {
|
|||||||
);
|
);
|
||||||
const currentDefault = getDefaultEditor(application);
|
const currentDefault = getDefaultEditor(application);
|
||||||
|
|
||||||
if (value !== 'plain-editor') {
|
if (value !== EditorIdentifier.PlainEditor) {
|
||||||
const editorComponent = editors.filter(
|
const editorComponent = editors.filter(
|
||||||
(e) => e.package_info.identifier === value
|
(e) => e.package_info.identifier === value
|
||||||
)[0];
|
)[0];
|
||||||
|
|||||||
Reference in New Issue
Block a user