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() {
|
addSettings() {
|
||||||
this.app.pluginSettingsManager.add('ui-schema-storage', {
|
// hide old block template settings page
|
||||||
title: '{{t("Block templates")}}',
|
// this.app.pluginSettingsManager.add('ui-schema-storage', {
|
||||||
icon: 'LayoutOutlined',
|
// title: '{{t("Block templates")}}',
|
||||||
Component: BlockTemplatesPane,
|
// icon: 'LayoutOutlined',
|
||||||
aclSnippet: 'pm.ui-schema-storage.block-templates',
|
// Component: BlockTemplatesPane,
|
||||||
});
|
// aclSnippet: 'pm.ui-schema-storage.block-templates',
|
||||||
|
// });
|
||||||
this.app.pluginSettingsManager.add('system-settings', {
|
this.app.pluginSettingsManager.add('system-settings', {
|
||||||
icon: 'SettingOutlined',
|
icon: 'SettingOutlined',
|
||||||
title: '{{t("System settings")}}',
|
title: '{{t("System settings")}}',
|
||||||
|
@ -18,7 +18,7 @@ export const DeprecatedTemplateTitle = () => {
|
|||||||
<Space>
|
<Space>
|
||||||
{t('Deprecated')}
|
{t('Deprecated')}
|
||||||
<Tooltip
|
<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 />
|
<QuestionCircleOutlined />
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
@ -8,27 +8,23 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
|
import { useLocation } from 'react-router-dom';
|
||||||
import { useFieldSchema } from '@formily/react';
|
import { useFieldSchema } from '@formily/react';
|
||||||
|
|
||||||
export const useIsPageBlock = () => {
|
export const useIsPageBlock = () => {
|
||||||
|
const location = useLocation();
|
||||||
const fieldSchema = useFieldSchema();
|
const fieldSchema = useFieldSchema();
|
||||||
|
|
||||||
const isPageBlock = useMemo(() => {
|
const isPageBlock = useMemo(() => {
|
||||||
if (!fieldSchema || fieldSchema['x-template-uid']) {
|
if (!fieldSchema || fieldSchema['x-template-uid']) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
const isPage = location.pathname.includes('/admin/') || location.pathname.includes('/m/');
|
||||||
let schema = fieldSchema.parent;
|
const notInPopup = !location.pathname.includes('/popups/');
|
||||||
while (schema) {
|
const notInSetting = !location.pathname.includes('/admin/settings/');
|
||||||
if (['Page', 'MobilePage'].includes(schema['x-component'])) {
|
const notInBlockTemplate = !location.pathname.includes('/m/block-templates/');
|
||||||
return true;
|
return isPage && notInPopup && notInSetting && notInBlockTemplate;
|
||||||
}
|
}, [location.pathname, fieldSchema]);
|
||||||
if (!['Grid', 'Grid.Row', 'Grid.Col'].includes(schema['x-component'])) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
schema = schema.parent;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}, [fieldSchema]);
|
|
||||||
|
|
||||||
return isPageBlock;
|
return isPageBlock;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user