mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-07 22:49:26 +08:00
fix: save as template not shown (#6398)
* fix: save as template not shown * fix: block template settings and route handling * fix: incorrect l18n
This commit is contained in:
parent
f70ff6da80
commit
b73f170edd
@ -29,12 +29,13 @@ export class PMPlugin extends Plugin {
|
||||
}
|
||||
|
||||
addSettings() {
|
||||
this.app.pluginSettingsManager.add('ui-schema-storage', {
|
||||
title: '{{t("Block templates")}}',
|
||||
icon: 'LayoutOutlined',
|
||||
Component: BlockTemplatesPane,
|
||||
aclSnippet: 'pm.ui-schema-storage.block-templates',
|
||||
});
|
||||
// hide old block template settings page
|
||||
// this.app.pluginSettingsManager.add('ui-schema-storage', {
|
||||
// title: '{{t("Block templates")}}',
|
||||
// icon: 'LayoutOutlined',
|
||||
// Component: BlockTemplatesPane,
|
||||
// aclSnippet: 'pm.ui-schema-storage.block-templates',
|
||||
// });
|
||||
this.app.pluginSettingsManager.add('system-settings', {
|
||||
icon: 'SettingOutlined',
|
||||
title: '{{t("System settings")}}',
|
||||
|
@ -18,7 +18,7 @@ export const DeprecatedTemplateTitle = () => {
|
||||
<Space>
|
||||
{t('Deprecated')}
|
||||
<Tooltip
|
||||
title={t('The following old template features have been deprecated and will be removed in next versions.')}
|
||||
title={t('The following old template features have been deprecated and will be removed in next version.')}
|
||||
>
|
||||
<QuestionCircleOutlined />
|
||||
</Tooltip>
|
||||
|
@ -8,27 +8,23 @@
|
||||
*/
|
||||
|
||||
import { useMemo } from 'react';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
import { useFieldSchema } from '@formily/react';
|
||||
|
||||
export const useIsPageBlock = () => {
|
||||
const location = useLocation();
|
||||
const fieldSchema = useFieldSchema();
|
||||
|
||||
const isPageBlock = useMemo(() => {
|
||||
if (!fieldSchema || fieldSchema['x-template-uid']) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let schema = fieldSchema.parent;
|
||||
while (schema) {
|
||||
if (['Page', 'MobilePage'].includes(schema['x-component'])) {
|
||||
return true;
|
||||
}
|
||||
if (!['Grid', 'Grid.Row', 'Grid.Col'].includes(schema['x-component'])) {
|
||||
return false;
|
||||
}
|
||||
schema = schema.parent;
|
||||
}
|
||||
return false;
|
||||
}, [fieldSchema]);
|
||||
const isPage = location.pathname.includes('/admin/') || location.pathname.includes('/m/');
|
||||
const notInPopup = !location.pathname.includes('/popups/');
|
||||
const notInSetting = !location.pathname.includes('/admin/settings/');
|
||||
const notInBlockTemplate = !location.pathname.includes('/m/block-templates/');
|
||||
return isPage && notInPopup && notInSetting && notInBlockTemplate;
|
||||
}, [location.pathname, fieldSchema]);
|
||||
|
||||
return isPageBlock;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user