diff --git a/packages/strapi-helper-plugin/lib/src/utils/getFilterType.js b/packages/strapi-helper-plugin/lib/src/utils/getFilterType.js index ee8abea48e..f4b4a61e51 100644 --- a/packages/strapi-helper-plugin/lib/src/utils/getFilterType.js +++ b/packages/strapi-helper-plugin/lib/src/utils/getFilterType.js @@ -37,14 +37,15 @@ const getFilterType = type => { id: 'components.FilterOptions.FILTER_TYPES._containss', value: '_containss', }, - { - id: 'components.FilterOptions.FILTER_TYPES._in', - value: '_in', - }, - { - id: 'components.FilterOptions.FILTER_TYPES._nin', - value: '_nin', - }, + // These lines are commented until we support the array in the admin + // { + // id: 'components.FilterOptions.FILTER_TYPES._in', + // value: '_in', + // }, + // { + // id: 'components.FilterOptions.FILTER_TYPES._nin', + // value: '_nin', + // }, ]; case 'integer': case 'biginteger': diff --git a/packages/strapi-helper-plugin/lib/src/utils/tests/getFilterType.test.js b/packages/strapi-helper-plugin/lib/src/utils/tests/getFilterType.test.js index 7e70e05c01..c48847548d 100644 --- a/packages/strapi-helper-plugin/lib/src/utils/tests/getFilterType.test.js +++ b/packages/strapi-helper-plugin/lib/src/utils/tests/getFilterType.test.js @@ -35,14 +35,15 @@ describe('HELPER PLUGIN | utils | getFilterType', () => { id: 'components.FilterOptions.FILTER_TYPES._containss', value: '_containss', }, - { - id: 'components.FilterOptions.FILTER_TYPES._in', - value: '_in', - }, - { - id: 'components.FilterOptions.FILTER_TYPES._nin', - value: '_nin', - }, + // Commenting until we support them + // { + // id: 'components.FilterOptions.FILTER_TYPES._in', + // value: '_in', + // }, + // { + // id: 'components.FilterOptions.FILTER_TYPES._nin', + // value: '_nin', + // }, ]; it('should generate the expected array if type is text', () => { diff --git a/packages/strapi-plugin-upload/admin/src/components/EditForm/index.js b/packages/strapi-plugin-upload/admin/src/components/EditForm/index.js index d8a6399529..be9d02ad33 100644 --- a/packages/strapi-plugin-upload/admin/src/components/EditForm/index.js +++ b/packages/strapi-plugin-upload/admin/src/components/EditForm/index.js @@ -81,13 +81,7 @@ const EditForm = forwardRef( if (prefixedFileURL) { setSrc(prefixedFileURL); } else { - const reader = new FileReader(); - - reader.onloadend = () => { - setSrc(reader.result); - }; - - reader.readAsDataURL(fileToEdit.file); + setSrc(URL.createObjectURL(fileToEdit.file)); } } }, [isImg, isVideo, fileToEdit, prefixedFileURL]); diff --git a/packages/strapi-plugin-upload/admin/src/components/InputMedia/index.js b/packages/strapi-plugin-upload/admin/src/components/InputMedia/index.js index fb557dbb2d..f3dce4e98e 100644 --- a/packages/strapi-plugin-upload/admin/src/components/InputMedia/index.js +++ b/packages/strapi-plugin-upload/admin/src/components/InputMedia/index.js @@ -20,7 +20,7 @@ import Input from '../Input'; const InputMedia = ({ label, onChange, name, attribute, value, type }) => { const [modal, setModal] = useState({ isOpen: false, - step: null, + step: 'list', fileToEdit: null, }); const [fileToDisplay, setFileToDisplay] = useState(0); @@ -123,19 +123,17 @@ const InputMedia = ({ label, onChange, name, attribute, value, type }) => { - {modal.isOpen && ( - - )} + ); }; diff --git a/packages/strapi-plugin-upload/admin/src/containers/InputModalStepper/InputModalStepper.js b/packages/strapi-plugin-upload/admin/src/containers/InputModalStepper/InputModalStepper.js index 25488f5c81..9456f56369 100644 --- a/packages/strapi-plugin-upload/admin/src/containers/InputModalStepper/InputModalStepper.js +++ b/packages/strapi-plugin-upload/admin/src/containers/InputModalStepper/InputModalStepper.js @@ -206,14 +206,16 @@ const InputModalStepper = ({ isOpen, onToggle, onInputMediaChange }) => { const handleToggle = () => { if (filesToUploadLength > 0 || selectedFiles.length > 0) { // eslint-disable-next-line no-alert - const confirm = window.confirm(formatMessage({ id: getTrad('window.confirm.close-modal') })); + const confirm = window.confirm( + formatMessage({ id: getTrad('window.confirm.close-modal.files') }) + ); if (!confirm) { return; } } - onToggle(); + onToggle(true); }; const shouldDisplayNextButton = currentStep === 'browse' && displayNextButton; diff --git a/packages/strapi-plugin-upload/admin/src/containers/InputModalStepperProvider/index.js b/packages/strapi-plugin-upload/admin/src/containers/InputModalStepperProvider/index.js index e0e71f142e..fe54edc3d9 100644 --- a/packages/strapi-plugin-upload/admin/src/containers/InputModalStepperProvider/index.js +++ b/packages/strapi-plugin-upload/admin/src/containers/InputModalStepperProvider/index.js @@ -186,6 +186,8 @@ const InputModalStepperProvider = ({ }; const handleClose = () => { + setFormErrors(null); + dispatch({ type: 'RESET_PROPS', }); diff --git a/packages/strapi-plugin-upload/admin/src/containers/ModalStepper/index.js b/packages/strapi-plugin-upload/admin/src/containers/ModalStepper/index.js index 461c843901..fb2d4f0043 100644 --- a/packages/strapi-plugin-upload/admin/src/containers/ModalStepper/index.js +++ b/packages/strapi-plugin-upload/admin/src/containers/ModalStepper/index.js @@ -333,7 +333,7 @@ const ModalStepper = ({ } } - onToggle(); + onToggle(true); }; const handleUploadFiles = async () => {