Fix PR feedback

Signed-off-by: soupette <cyril.lpz@gmail.com>
This commit is contained in:
soupette 2020-04-10 15:25:00 +02:00
parent 3553025d59
commit e97b8cca71
3 changed files with 4 additions and 6 deletions

View File

@ -151,8 +151,6 @@ const Wysiwyg = ({
}
const handleChange = data => {
console.log(data);
if (data.mime.includes('image')) {
const imgTag = `<p><img src="${data.url}" caption="${data.caption}" alt="${data.alternativeText}"></img></p>`;
const newValue = value ? `${value}${imgTag}` : imgTag;
@ -160,7 +158,7 @@ const Wysiwyg = ({
onChange({ target: { name, value: newValue } });
}
// Handle videos and other type of files
// Handle videos and other type of files by adding some code
};
const handleToggle = () => setIsOpen(prev => !prev);

View File

@ -93,8 +93,8 @@ const Initializer = ({ updatePlugin }) => {
ref.current = updatePlugin;
useEffect(() => {
// Register the new field
strapi.componentApi.registerComponent({ name: 'm-component', Component: MyComponent });
// Register the new component
strapi.componentApi.registerComponent({ name: 'my-component', Component: MyComponent });
ref.current(pluginId, 'isReady', true);
}, []);

View File

@ -22,7 +22,7 @@ const MediaLib = ({ isOpen, onChange, onToggle }) => {
const handleInputChange = data => {
if (data) {
const { name, alternativeText, url } = data;
const alt = alternativeText === '' ? name : alternativeText;
const alt = alternativeText || name;
setData({ alt, url: prefixFileUrlWithBackendUrl(url) });
}