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',
|
id: 'components.FilterOptions.FILTER_TYPES._containss',
|
||||||
value: '_containss',
|
value: '_containss',
|
||||||
},
|
},
|
||||||
{
|
// 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._in',
|
||||||
},
|
// value: '_in',
|
||||||
{
|
// },
|
||||||
id: 'components.FilterOptions.FILTER_TYPES._nin',
|
// {
|
||||||
value: '_nin',
|
// id: 'components.FilterOptions.FILTER_TYPES._nin',
|
||||||
},
|
// value: '_nin',
|
||||||
|
// },
|
||||||
];
|
];
|
||||||
case 'integer':
|
case 'integer':
|
||||||
case 'biginteger':
|
case 'biginteger':
|
||||||
|
@ -35,14 +35,15 @@ describe('HELPER PLUGIN | utils | getFilterType', () => {
|
|||||||
id: 'components.FilterOptions.FILTER_TYPES._containss',
|
id: 'components.FilterOptions.FILTER_TYPES._containss',
|
||||||
value: '_containss',
|
value: '_containss',
|
||||||
},
|
},
|
||||||
{
|
// Commenting until we support them
|
||||||
id: 'components.FilterOptions.FILTER_TYPES._in',
|
// {
|
||||||
value: '_in',
|
// id: 'components.FilterOptions.FILTER_TYPES._in',
|
||||||
},
|
// value: '_in',
|
||||||
{
|
// },
|
||||||
id: 'components.FilterOptions.FILTER_TYPES._nin',
|
// {
|
||||||
value: '_nin',
|
// id: 'components.FilterOptions.FILTER_TYPES._nin',
|
||||||
},
|
// value: '_nin',
|
||||||
|
// },
|
||||||
];
|
];
|
||||||
|
|
||||||
it('should generate the expected array if type is text', () => {
|
it('should generate the expected array if type is text', () => {
|
||||||
|
@ -81,13 +81,7 @@ const EditForm = forwardRef(
|
|||||||
if (prefixedFileURL) {
|
if (prefixedFileURL) {
|
||||||
setSrc(prefixedFileURL);
|
setSrc(prefixedFileURL);
|
||||||
} else {
|
} else {
|
||||||
const reader = new FileReader();
|
setSrc(URL.createObjectURL(fileToEdit.file));
|
||||||
|
|
||||||
reader.onloadend = () => {
|
|
||||||
setSrc(reader.result);
|
|
||||||
};
|
|
||||||
|
|
||||||
reader.readAsDataURL(fileToEdit.file);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [isImg, isVideo, fileToEdit, prefixedFileURL]);
|
}, [isImg, isVideo, fileToEdit, prefixedFileURL]);
|
||||||
|
@ -20,7 +20,7 @@ import Input from '../Input';
|
|||||||
const InputMedia = ({ label, onChange, name, attribute, value, type }) => {
|
const InputMedia = ({ label, onChange, name, attribute, value, type }) => {
|
||||||
const [modal, setModal] = useState({
|
const [modal, setModal] = useState({
|
||||||
isOpen: false,
|
isOpen: false,
|
||||||
step: null,
|
step: 'list',
|
||||||
fileToEdit: null,
|
fileToEdit: null,
|
||||||
});
|
});
|
||||||
const [fileToDisplay, setFileToDisplay] = useState(0);
|
const [fileToDisplay, setFileToDisplay] = useState(0);
|
||||||
@ -123,19 +123,17 @@ const InputMedia = ({ label, onChange, name, attribute, value, type }) => {
|
|||||||
<Input type="file" name={name} />
|
<Input type="file" name={name} />
|
||||||
</CardPreviewWrapper>
|
</CardPreviewWrapper>
|
||||||
|
|
||||||
{modal.isOpen && (
|
<InputModalStepper
|
||||||
<InputModalStepper
|
isOpen={modal.isOpen}
|
||||||
isOpen={modal.isOpen}
|
step={modal.step}
|
||||||
step={modal.step}
|
fileToEdit={modal.fileToEdit}
|
||||||
fileToEdit={modal.fileToEdit}
|
filesToUpload={modal.filesToUpload}
|
||||||
filesToUpload={modal.filesToUpload}
|
multiple={attribute.multiple}
|
||||||
multiple={attribute.multiple}
|
onInputMediaChange={handleChange}
|
||||||
onInputMediaChange={handleChange}
|
selectedFiles={value}
|
||||||
selectedFiles={value}
|
onToggle={handleClickToggleModal}
|
||||||
onToggle={handleClickToggleModal}
|
allowedTypes={attribute.allowedTypes}
|
||||||
allowedTypes={attribute.allowedTypes}
|
/>
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</Wrapper>
|
</Wrapper>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -206,14 +206,16 @@ const InputModalStepper = ({ isOpen, onToggle, onInputMediaChange }) => {
|
|||||||
const handleToggle = () => {
|
const handleToggle = () => {
|
||||||
if (filesToUploadLength > 0 || selectedFiles.length > 0) {
|
if (filesToUploadLength > 0 || selectedFiles.length > 0) {
|
||||||
// eslint-disable-next-line no-alert
|
// 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) {
|
if (!confirm) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onToggle();
|
onToggle(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
const shouldDisplayNextButton = currentStep === 'browse' && displayNextButton;
|
const shouldDisplayNextButton = currentStep === 'browse' && displayNextButton;
|
||||||
|
@ -186,6 +186,8 @@ const InputModalStepperProvider = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleClose = () => {
|
const handleClose = () => {
|
||||||
|
setFormErrors(null);
|
||||||
|
|
||||||
dispatch({
|
dispatch({
|
||||||
type: 'RESET_PROPS',
|
type: 'RESET_PROPS',
|
||||||
});
|
});
|
||||||
|
@ -333,7 +333,7 @@ const ModalStepper = ({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onToggle();
|
onToggle(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleUploadFiles = async () => {
|
const handleUploadFiles = async () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user