fix: media config top level (#716)

This commit is contained in:
Daniel Lautzenheiser 2023-04-19 15:59:54 -04:00 committed by GitHub
parent f27a7cd420
commit 12179e59a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 4 deletions

View File

@ -188,6 +188,7 @@
'---\ntitle: "This is post # ' +
i +
`\"\ndraft: ${i % 2 === 0}` +
'\nimage: /assets/uploads/lobby.jpg' +
'\ndate: ' +
dateString +
'T00:00:00.000Z\n---\n# The post is number ' +

View File

@ -72,6 +72,8 @@ const MediaLibrary: FC<TranslatedProps<MediaLibraryProps>> = ({
const [selectedFile, setSelectedFile] = useState<MediaFile | null>(null);
const [query, setQuery] = useState<string | undefined>(undefined);
const config = useAppSelector(selectConfig);
const dispatch = useAppDispatch();
const {
isVisible,
@ -83,7 +85,7 @@ const MediaLibrary: FC<TranslatedProps<MediaLibraryProps>> = ({
isLoading,
hasNextPage,
isPaginating,
config: mediaConfig,
config: mediaConfig = config?.media_library ?? {},
dynamicSearchQuery,
page,
collection,
@ -94,7 +96,6 @@ const MediaLibrary: FC<TranslatedProps<MediaLibraryProps>> = ({
insertOptions,
} = useAppSelector(selectMediaLibraryState);
const config = useAppSelector(selectConfig);
const entry = useAppSelector(selectEditingDraft);
const [url, setUrl] = useState<string | string[] | undefined>(initialValue ?? '');

View File

@ -40,7 +40,7 @@ export type MediaLibraryState = {
controlID?: string;
page?: number;
files?: MediaFile[];
config: MediaLibraryConfig;
config?: MediaLibraryConfig;
collection?: Collection;
collectionFile?: CollectionFile;
field?: MediaField;
@ -65,7 +65,6 @@ const defaultState: MediaLibraryState = {
showMediaButton: true,
controlMedia: {},
displayURLs: {},
config: {},
};
function mediaLibrary(