refactor: fixedBlockDesignerItem (#3550)

This commit is contained in:
katherinehhh 2024-02-23 22:14:57 +08:00 committed by GitHub
parent 3a0f942270
commit 3d1f73fcaf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -6,6 +6,7 @@ import { useRecord } from '../../../record-provider';
import { useDesignable } from '../../hooks';
import { useIsBlockInPage } from './hooks/useIsBlockInPage';
import { SchemaSettingsSwitchItem } from '../../../schema-settings';
import { useBlockRequestContext } from '../../../block-provider/BlockProvider';
const FixedBlockContext = React.createContext<{
setFixedBlock: (value: string | false) => void;
@ -73,6 +74,7 @@ export const FixedBlockDesignerItem = () => {
const { dn } = useDesignable();
const { inFixedBlock } = useFixedBlock();
const { isBlockInPage } = useIsBlockInPage();
const { service } = useBlockRequestContext();
if (!isBlockInPage() || !inFixedBlock) {
return null;
@ -93,6 +95,7 @@ export const FixedBlockDesignerItem = () => {
},
});
field.decoratorProps = fieldSchema['x-decorator-props'] = decoratorProps;
service?.refresh?.();
}}
/>
);