fix: copy media_library settings for markdown widgets, do not show directories if folder support is off
This commit is contained in:
parent
c42127c261
commit
74e06ecc5c
@ -61,7 +61,7 @@ const setFieldDefaults =
|
||||
return { ...field, public_folder: field.media_folder };
|
||||
}
|
||||
|
||||
if (field.widget === 'image' || field.widget === 'file') {
|
||||
if (field.widget === 'image' || field.widget === 'file' || field.widget === 'markdown') {
|
||||
field.media_library = {
|
||||
...((collectionFile ?? collection).media_library ?? {}),
|
||||
...(field.media_library ?? {}),
|
||||
|
@ -31,6 +31,7 @@ export default function useMediaFiles(field?: MediaField, currentFolder?: string
|
||||
);
|
||||
|
||||
const folderSupport = useFolderSupport({ config, collection, collectionFile, field });
|
||||
console.log('FOLDER_SUPPORT', folderSupport);
|
||||
|
||||
useEffect(() => {
|
||||
if (!currentFolder || !config || !entry) {
|
||||
@ -105,5 +106,8 @@ export default function useMediaFiles(field?: MediaField, currentFolder?: string
|
||||
return mediaLibraryFiles ?? [];
|
||||
}, [collection, config, currentFolderMediaFiles, entry, field, mediaLibraryFiles, currentFolder]);
|
||||
|
||||
return useMemo(() => files.filter(file => file.name !== '.gitkeep'), [files]);
|
||||
return useMemo(
|
||||
() => files.filter(file => file.name !== '.gitkeep' && (folderSupport || !file.isDirectory)),
|
||||
[files, folderSupport],
|
||||
);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user