chore: fix linting errors and export more hooks

This commit is contained in:
Daniel Lautzenheiser 2023-04-19 11:02:01 -04:00
parent 28fd9caf4c
commit 4a73ea65fd
5 changed files with 30 additions and 2 deletions

View File

@ -194,7 +194,7 @@ const MediaLibrary: FC<TranslatedProps<MediaLibraryProps>> = ({
setSelectedFile(asset);
},
[canInsert, selectedFile?.key],
[canInsert, forFolder, selectedFile?.key],
);
const scrollContainerRef = useRef<HTMLDivElement | null>(null);

View File

@ -6,6 +6,10 @@ import useMediaAsset from './lib/hooks/useMediaAsset';
import useMediaInsert from './lib/hooks/useMediaInsert';
import useUUID from './lib/hooks/useUUID';
import Registry from './lib/registry';
import useEntries from './lib/hooks/useEntries';
import useHasChildErrors from './lib/hooks/useHasChildErrors';
import useMediaFiles from './lib/hooks/useMediaFiles';
import useFolderSupport from './lib/hooks/useFolderSupport';
export * from './backends';
export * from './interface';
@ -25,8 +29,13 @@ if (typeof window !== 'undefined') {
window.useEffect = window.useEffect || useEffect;
window.useCallback = window.useCallback || useCallback;
window.h = window.h || createElement;
window.useEntries = window.useEntries || useEntries;
window.useFolderSupport = window.useFolderSupport || useFolderSupport;
window.useHasChildErrors = window.useHasChildErrors || useHasChildErrors;
window.useIsMediaAsset = window.useIsMediaAsset || useIsMediaAsset;
window.useMediaAsset = window.useMediaAsset || useMediaAsset;
window.useMediaFiles = window.useMediaFiles || useMediaFiles;
window.useMediaInsert = window.useMediaInsert || useMediaInsert;
window.useUUID = window.useUUID || useUUID;
}

View File

@ -1,4 +1,8 @@
export { default as useEntries } from './useEntries';
export { default as useFolderSupport } from './useFolderSupport';
export { default as useHasChildErrors } from './useHasChildErrors';
export { default as useIsMediaAsset } from './useIsMediaAsset';
export { default as useMediaAsset } from './useMediaAsset';
export { default as useMediaFiles } from './useMediaFiles';
export { default as useMediaInsert } from './useMediaInsert';
export { default as useUUID } from './useUUID';

View File

@ -3,7 +3,16 @@ export {};
import type { Config } from '../interface';
import type CmsAPI from '../index';
import type { createElement, useEffect, useState, useMemo, useCallback } from 'react';
import type { useIsMediaAsset, useMediaAsset, useMediaInsert, useUUID } from '../lib/hooks';
import type {
useEntries,
useFolderSupport,
useHasChildErrors,
useIsMediaAsset,
useMediaAsset,
useMediaFiles,
useMediaInsert,
useUUID,
} from '../lib/hooks';
declare global {
interface Window {
@ -15,8 +24,13 @@ declare global {
useMemo: useMemo;
useEffect: useEffect;
useCallback: useCallback;
useEntries: useEntries;
useFolderSupport: useFolderSupport;
useHasChildErrors: useHasChildErrors;
useIsMediaAsset: useIsMediaAsset;
useMediaAsset: useMediaAsset;
useMediaFiles: useMediaFiles;
useMediaInsert: useMediaInsert;
useUUID: useUUID;
}

View File

@ -294,6 +294,7 @@ const withFileControl = ({ forImage = false }: WithFileControlProps = {}) => {
</div>
);
}, [
forFolder,
internalValue,
renderedImagesLinks,
handleOpenMediaLibrary,