this.onToggle(item)}>
-
this.onContext(item)} onClick={() => this.onClick(item)} > {icon} @@ -268,7 +274,7 @@ const SidebarSettings = observer(class SidebarSettings extends React.Component
{ + return item; + }, + } + }); + }; + onToggle (item) { this.toggle[item.id] = !this.toggle[item.id]; this.forceUpdate(); }; + + onAdd (e, item) { + e.preventDefault(); + e.stopPropagation(); + + const isPopup = keyboard.isPopup(); + + switch (item.id) { + case 'contentModelTypes': { + const type = S.Record.getTypeType(); + const featured = [ 'type', 'tag', 'backlinks' ]; + const recommended = []; + const mapper = it => S.Record.getRelationByKey(it)?.id; + const details: any = { + isNew: true, + type: type.id, + layout: I.ObjectLayout.Type, + recommendedFeaturedRelations: featured.map(mapper).filter(it => it), + recommendedRelations: recommended.map(mapper).filter(it => it), + }; + + sidebar.rightPanelToggle(true, true, isPopup, 'type', { details }); + break; + }; + + case 'contentModelRelations': { + const node = $(this.node); + const width = node.width() - 32; + + S.Menu.open('blockRelationEdit', { + element: `#containerSettings #item-toggle-${item.id} .plus`, + offsetY: 4, + width, + className: 'fixed', + classNameWrap: 'fromSidebar', + horizontal: I.MenuDirection.Right, + }); + + break; + }; + }; + }; }); -export default SidebarSettings \ No newline at end of file +export default SidebarSettings