diff --git a/packages/core/dev-test/index.html b/packages/core/dev-test/index.html index b7c4ce5b..cd2724a5 100644 --- a/packages/core/dev-test/index.html +++ b/packages/core/dev-test/index.html @@ -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 ' + diff --git a/packages/core/src/components/media-library/common/MediaLibrary.tsx b/packages/core/src/components/media-library/common/MediaLibrary.tsx index e224ae9a..2aa6a6e1 100644 --- a/packages/core/src/components/media-library/common/MediaLibrary.tsx +++ b/packages/core/src/components/media-library/common/MediaLibrary.tsx @@ -72,6 +72,8 @@ const MediaLibrary: FC> = ({ const [selectedFile, setSelectedFile] = useState(null); const [query, setQuery] = useState(undefined); + const config = useAppSelector(selectConfig); + const dispatch = useAppDispatch(); const { isVisible, @@ -83,7 +85,7 @@ const MediaLibrary: FC> = ({ isLoading, hasNextPage, isPaginating, - config: mediaConfig, + config: mediaConfig = config?.media_library ?? {}, dynamicSearchQuery, page, collection, @@ -94,7 +96,6 @@ const MediaLibrary: FC> = ({ insertOptions, } = useAppSelector(selectMediaLibraryState); - const config = useAppSelector(selectConfig); const entry = useAppSelector(selectEditingDraft); const [url, setUrl] = useState(initialValue ?? ''); diff --git a/packages/core/src/reducers/mediaLibrary.ts b/packages/core/src/reducers/mediaLibrary.ts index b2036608..caa7ceff 100644 --- a/packages/core/src/reducers/mediaLibrary.ts +++ b/packages/core/src/reducers/mediaLibrary.ts @@ -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(