fix: compatible with historical blocks

This commit is contained in:
katherinehhh 2023-05-09 13:33:15 +08:00
parent 644d31b39c
commit 7d461193df
2 changed files with 2 additions and 3 deletions

View File

@ -23,14 +23,13 @@ export const Editable = observer((props: any) => {
const collectionField = getField(field.props.name); const collectionField = getField(field.props.name);
const isFileCollection = getCollection(collectionField?.target).template === 'file'; const isFileCollection = getCollection(collectionField?.target).template === 'file';
const [currentMode, setCurrentMode] = useState(props.mode || (isFileCollection ? 'FileManager' : 'Select')); const [currentMode, setCurrentMode] = useState(props.mode || (isFileCollection ? 'FileManager' : 'Select'));
const isOldRecordPicker = fieldSchema.reduceProperties((buf, schema) => { const isOldRecordPicker = fieldSchema.reduceProperties((buf, schema) => {
if (schema['x-component'].includes('RecordPicker.')) { if (schema['x-component'].includes('RecordPicker.')) {
return schema; return schema;
} }
return buf; return buf;
}, null); }, null);
if (isOldRecordPicker) { if (isOldRecordPicker && !props.mode) {
return <RecordPicker {...props} />; return <RecordPicker {...props} />;
} }
const useCreateActionProps = () => { const useCreateActionProps = () => {

View File

@ -29,7 +29,7 @@ export const ReadPretty = observer((props: any) => {
return buf; return buf;
}, null); }, null);
if (isOldRecordPicker) { if (isOldRecordPicker && !props.mode) {
return <RecordPicker.ReadPretty {...props} />; return <RecordPicker.ReadPretty {...props} />;
} }
return ( return (