refactor: Sort editor array after concat
This commit is contained in:
@@ -100,9 +100,6 @@ export const Defaults: FunctionComponent<Props> = ({ application }) => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const editors = application.componentManager
|
const editors = application.componentManager
|
||||||
.componentsForArea(ComponentArea.Editor)
|
.componentsForArea(ComponentArea.Editor)
|
||||||
.sort((a, b) => {
|
|
||||||
return a.name.toLowerCase() < b.name.toLowerCase() ? -1 : 1;
|
|
||||||
})
|
|
||||||
.map((editor) => {
|
.map((editor) => {
|
||||||
const identifier = editor.package_info.identifier;
|
const identifier = editor.package_info.identifier;
|
||||||
const iconType = getEditorIconType(identifier);
|
const iconType = getEditorIconType(identifier);
|
||||||
@@ -112,16 +109,19 @@ export const Defaults: FunctionComponent<Props> = ({ application }) => {
|
|||||||
value: identifier,
|
value: identifier,
|
||||||
...(iconType ? { icon: iconType } : null),
|
...(iconType ? { icon: iconType } : null),
|
||||||
};
|
};
|
||||||
|
})
|
||||||
|
.concat([
|
||||||
|
{
|
||||||
|
icon: 'plain-text',
|
||||||
|
label: 'Plain Editor',
|
||||||
|
value: EditorIdentifier.PlainEditor,
|
||||||
|
},
|
||||||
|
])
|
||||||
|
.sort((a, b) => {
|
||||||
|
return a.label.toLowerCase() < b.label.toLowerCase() ? -1 : 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
setEditorItems([
|
setEditorItems(editors);
|
||||||
{
|
|
||||||
icon: 'plain-text',
|
|
||||||
label: 'Plain Editor',
|
|
||||||
value: EditorIdentifier.PlainEditor,
|
|
||||||
},
|
|
||||||
...editors,
|
|
||||||
]);
|
|
||||||
}, [application]);
|
}, [application]);
|
||||||
|
|
||||||
const setDefaultEditor = (value: string) => {
|
const setDefaultEditor = (value: string) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user