Laravel 8中CKEditor5插入的YouTube链接前端无法显示求助
CKEditor5生成oEmbed标签前端无法渲染,如何替换为可用的iframe/video标签?
运行环境
- Laravel 8
- jQuery 3.6
- CKEditor5
问题现象
后台点击工具栏默认的「插入媒体」按钮,粘贴YouTube链接后,CKEditor5编辑器内可正常预览视频,但前端页面无法渲染该视频内容。
前端Blade模板代码
<div class="news-view-content"> {!! $news->content !!} <hr> <hr> <hr> {{ $news->content }} </div>
CKEditor5输出的内容文本
<figure class="media"> <oembed url="https://www.youtube.com/watch?v=hufhhf2MSHU"></oembed> </figure>
验证情况
测试发现,直接使用iframe标签嵌入YouTube视频、video标签展示本地上传视频,均可在前端正常显示:
YouTube视频可用代码示例
<iframe src="https://www.youtube.com/embed/key" title="_you_tubevideoplayer" frameborder="0" allow="accelerometer;autoplay;clipboard-write;encrypted-media;gyroscope;picture-in-picture;web-share" allowfullscreen> </iframe>
本地视频可用代码示例
<video controls preload="auto" class="news-videovideo-jsnews_video_playervjs-theme-forest" data-setup='{}' type="video/x-msvideo"> <source src="http://127.0.0.1:8000/storage/160/sample.avi"> </video>
疑问
能否将CKEditor5默认生成的oEmbed标签替换为上述可用的iframe或video标签?需要更换插件或进行哪些设置才能让视频在前端正常显示?
内容的提问来源于stack exchange,提问作者mstdmstd
相关产品推荐
相关产品推荐

