diff --git a/packages/core/client/src/application/PluginSettingsManager.ts b/packages/core/client/src/application/PluginSettingsManager.ts index ca8ecef88..5a0ad9d4b 100644 --- a/packages/core/client/src/application/PluginSettingsManager.ts +++ b/packages/core/client/src/application/PluginSettingsManager.ts @@ -1,5 +1,6 @@ import { set } from 'lodash'; import { createElement } from 'react'; +import { Outlet } from 'react-router-dom'; import { Icon } from '../icon'; import type { Application } from './Application'; @@ -11,14 +12,16 @@ export const SNIPPET_PREFIX = 'pm.'; export interface PluginSettingsManagerSettingOptionsType { title: string; - Component: RouteType['Component']; + /** + * @default Outlet + */ + Component?: RouteType['Component']; icon?: string; /** * sort, the smaller the number, the higher the priority * @default 0 */ sort?: number; - isBookmark?: boolean; aclSnippet?: string; [index: string]: any; } @@ -32,7 +35,6 @@ export interface PluginSettingsPageType { sort?: number; name?: string; pluginName?: string; - isBookmark?: boolean; children?: PluginSettingsPageType[]; [index: string]: any; } @@ -65,7 +67,7 @@ export class PluginSettingsManager { add(name: string, options: PluginSettingsManagerSettingOptionsType) { const nameArr = name.split('.'); const pluginName = nameArr[0]; - this.settings[name] = { ...options, name, pluginName }; + this.settings[name] = { Component: Outlet, ...options, name, pluginName }; // add children if (nameArr.length > 1) { @@ -75,7 +77,7 @@ export class PluginSettingsManager { // add route this.app.router.add(this.getRouteName(name), { path: this.getRoutePath(name), - Component: options.Component, + Component: this.settings[name].Component, }); } diff --git a/packages/core/client/src/pm/index.tsx b/packages/core/client/src/pm/index.tsx index 2991bf7fa..24ef1fd10 100644 --- a/packages/core/client/src/pm/index.tsx +++ b/packages/core/client/src/pm/index.tsx @@ -27,28 +27,23 @@ export class PMPlugin extends Plugin { icon: 'LockOutlined', Component: ACLPane, aclSnippet: 'pm.acl.roles', - isBookmark: true, }); this.app.pluginSettingsManager.add('ui-schema-storage', { title: '{{t("Block templates")}}', icon: 'LayoutOutlined', Component: BlockTemplatesPane, - isBookmark: true, aclSnippet: 'pm.ui-schema-storage.block-templates', }); this.app.pluginSettingsManager.add('system-settings', { icon: 'SettingOutlined', title: '{{t("System settings")}}', Component: SystemSettingsPane, - isBookmark: true, aclSnippet: 'pm.system-settings.system-settings', }); this.app.pluginSettingsManager.add('collection-manager', { icon: 'DatabaseOutlined', title: '{{t("Collection manager")}}', - Component: () => , - isBookmark: true, }); this.app.pluginSettingsManager.add('collection-manager.collections', {