Change to record to avoid duplicate additional links during development

This commit is contained in:
Daniel Lautzenheiser 2022-09-20 10:39:46 -04:00
parent 57b0bce367
commit 0cd462333e
2 changed files with 4 additions and 4 deletions

View File

@ -205,7 +205,7 @@ export class Sidebar extends React.Component {
.toList()
.filter(collection => collection.get('hide') !== true)
.map(collection => this.renderLink(collection, filterTerm))}
{additionalLinks.map(this.renderAdditionalLink)}
{Object.values(additionalLinks).map(this.renderAdditionalLink)}
</SidebarNavList>
</SidebarContainer>
);

View File

@ -26,7 +26,7 @@ const registry = {
previewStyles: [],
widgets: {},
icons: {},
additionalLinks: [],
additionalLinks: {},
editorComponents: Map(),
remarkPlugins: [],
widgetValueSerializers: {},
@ -304,8 +304,8 @@ export function getIcon(name) {
/**
* Icons
*/
export function registerAdditionalLink(title, url, iconName) {
registry.additionalLinks.push({ title, url, iconName });
export function registerAdditionalLink(id, title, url, iconName) {
registry.additionalLinks[id] = { title, url, iconName };
}
export function getAdditionalLinks() {
return registry.additionalLinks;