strapi-plugin-ckeditor
strapi-plugin-ckeditor copied to clipboard
Unable to add video from media library
Hello, i'm not able to add any video from media library, and there is no error.
Nothing in console, nothing in log..
Do am i missing something? Have I forgotten some configuration or is it a bug?
Thanks
Strapi 4.5.2 strapi-plugin-ckeditor 1.1.2
I'm struggling with the same issue. I think it's just not supported.
Hi! Inserting videos from the media library is not supported yet. For now, you can use the Media embed plugin.
The same issue here. Thank you for providing this great plugin, we are waiting for good features like this one.
Hi! Inserting videos from the media library is not supported yet. For now, you can use the Media embed plugin.
@Mgsy Today I found out that Media embed is just useful for some sources and when pasting an hosted video it raises this error "The media URL is not supported"
any updates on this feature? @Mgsy
I changed the admin/src/components/CKEditorInput/index.js and succeeded. Currently it works good enough for my use case:
const handleChangeAssets = assets => {
let assetsHtmlString = '';
assets.map(asset => {
const url = sanitize(asset.url);
const alt = sanitize(asset.alt);
if (asset.mime.includes('image')) {
assetsHtmlString += `<img src="${url}" alt="${alt}" />`;
} else {
assetsHtmlString += `<a href="${url}" target="_blank">${alt} (${asset.mime})</a>`;
}
});
const viewFragment = editorInstance.data.processor.toView(assetsHtmlString);
const modelFragment = editorInstance.data.toModel(viewFragment);
editorInstance.model.insertContent(modelFragment);
handleToggleMediaLib();
};
So I rendered the inserted video as a link. It can be improved with some preview library for example iframely or embedly.
https://github.com/user-attachments/assets/6cbf36b6-3dc6-463e-9ea4-7ee8566c8501
It's good enough for my use case as I don't need to preview it in the editor, I parsed the html (a href=a video src) in the front end and rendered it as video: