mirror of
https://github.com/strapi/strapi.git
synced 2025-09-21 14:31:16 +00:00
Fix video preview and other small bugs
Signed-off-by: soupette <cyril.lpz@gmail.com>
This commit is contained in:
parent
01a5bd4fb4
commit
67a2e6ab4b
@ -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':
|
||||
|
@ -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', () => {
|
||||
|
@ -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]);
|
||||
|
@ -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 }) => {
|
||||
<Input type="file" name={name} />
|
||||
</CardPreviewWrapper>
|
||||
|
||||
{modal.isOpen && (
|
||||
<InputModalStepper
|
||||
isOpen={modal.isOpen}
|
||||
step={modal.step}
|
||||
fileToEdit={modal.fileToEdit}
|
||||
filesToUpload={modal.filesToUpload}
|
||||
multiple={attribute.multiple}
|
||||
onInputMediaChange={handleChange}
|
||||
selectedFiles={value}
|
||||
onToggle={handleClickToggleModal}
|
||||
allowedTypes={attribute.allowedTypes}
|
||||
/>
|
||||
)}
|
||||
<InputModalStepper
|
||||
isOpen={modal.isOpen}
|
||||
step={modal.step}
|
||||
fileToEdit={modal.fileToEdit}
|
||||
filesToUpload={modal.filesToUpload}
|
||||
multiple={attribute.multiple}
|
||||
onInputMediaChange={handleChange}
|
||||
selectedFiles={value}
|
||||
onToggle={handleClickToggleModal}
|
||||
allowedTypes={attribute.allowedTypes}
|
||||
/>
|
||||
</Wrapper>
|
||||
);
|
||||
};
|
||||
|
@ -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;
|
||||
|
@ -186,6 +186,8 @@ const InputModalStepperProvider = ({
|
||||
};
|
||||
|
||||
const handleClose = () => {
|
||||
setFormErrors(null);
|
||||
|
||||
dispatch({
|
||||
type: 'RESET_PROPS',
|
||||
});
|
||||
|
@ -333,7 +333,7 @@ const ModalStepper = ({
|
||||
}
|
||||
}
|
||||
|
||||
onToggle();
|
||||
onToggle(true);
|
||||
};
|
||||
|
||||
const handleUploadFiles = async () => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user