refactor: fixedBlockDesignerItem (#3550)
This commit is contained in:
		
							parent
							
								
									3a0f942270
								
							
						
					
					
						commit
						3d1f73fcaf
					
				@ -6,6 +6,7 @@ import { useRecord } from '../../../record-provider';
 | 
				
			|||||||
import { useDesignable } from '../../hooks';
 | 
					import { useDesignable } from '../../hooks';
 | 
				
			||||||
import { useIsBlockInPage } from './hooks/useIsBlockInPage';
 | 
					import { useIsBlockInPage } from './hooks/useIsBlockInPage';
 | 
				
			||||||
import { SchemaSettingsSwitchItem } from '../../../schema-settings';
 | 
					import { SchemaSettingsSwitchItem } from '../../../schema-settings';
 | 
				
			||||||
 | 
					import { useBlockRequestContext } from '../../../block-provider/BlockProvider';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const FixedBlockContext = React.createContext<{
 | 
					const FixedBlockContext = React.createContext<{
 | 
				
			||||||
  setFixedBlock: (value: string | false) => void;
 | 
					  setFixedBlock: (value: string | false) => void;
 | 
				
			||||||
@ -73,6 +74,7 @@ export const FixedBlockDesignerItem = () => {
 | 
				
			|||||||
  const { dn } = useDesignable();
 | 
					  const { dn } = useDesignable();
 | 
				
			||||||
  const { inFixedBlock } = useFixedBlock();
 | 
					  const { inFixedBlock } = useFixedBlock();
 | 
				
			||||||
  const { isBlockInPage } = useIsBlockInPage();
 | 
					  const { isBlockInPage } = useIsBlockInPage();
 | 
				
			||||||
 | 
					  const { service } = useBlockRequestContext();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (!isBlockInPage() || !inFixedBlock) {
 | 
					  if (!isBlockInPage() || !inFixedBlock) {
 | 
				
			||||||
    return null;
 | 
					    return null;
 | 
				
			||||||
@ -93,6 +95,7 @@ export const FixedBlockDesignerItem = () => {
 | 
				
			|||||||
          },
 | 
					          },
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
        field.decoratorProps = fieldSchema['x-decorator-props'] = decoratorProps;
 | 
					        field.decoratorProps = fieldSchema['x-decorator-props'] = decoratorProps;
 | 
				
			||||||
 | 
					        service?.refresh?.();
 | 
				
			||||||
      }}
 | 
					      }}
 | 
				
			||||||
    />
 | 
					    />
 | 
				
			||||||
  );
 | 
					  );
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user