CKEditor 4.1.1的HTML 5视频插件

5
这里有一个关于 ckeditor 的 HTML5 插件http://ckeditor.com/forums/Plugins/HTML5-Video,但不幸的是,该视频插件在 CKEditor 4.1.1 上无法正常工作。当你不查看源代码时,插件可以使用;但如果你点击源代码并返回编辑器,则会显示“您的浏览器不支持视频...”的提示。请问是否需要进行指导?

在 config.js 文件的哪个位置放置 extraAllowedContent: 'video[*]{*};source[*]{*}'?CKEDITOR.editorConfig = function( config ) { } - Jeff
config.js 位于 ckeditor 文件夹的根目录下。我没有测试过 extraAllowedContent,但是 CKEDITOR.config.allowedContent = true; 是可以的。 - Mohammad Dayyan
3个回答

16

您可以在CKEditor中仅指定关闭内容过滤。

extraAllowedContent: 'video[*]{*}'

在 config.js 文件中。


7
您需要在extraAllowedContent中添加“source”标签。extraAllowedContent: 'video[*]{*};source[*]{*}' - Luís Lopes
1
为了消除混淆:config.extraAllowedContent = 'video[*]{*};source[*]{*}'; - Stephan Weinhold
1
这是唯一有效的答案。你最不想要的就是因为使用了 allowedContent = true; 而导致安全漏洞。 - Drag and Drop

4

刚碰到了同样的问题。看来这是因为在 CKEditor 4.1 中他们添加了一些高级内容过滤器。实际上,如果插件没有明确说明某些标记(如<video></video>)被允许,那么它们就会被源编辑器删除!!!我的解决方法是通过在 ckeditor/config.js 文件的开头添加以下行来禁用编辑器中的 ACF:config.allowedContent = true

CKEDITOR.config.allowedContent = true;

通过这种方式,源代码编辑器不再检查HTML内容,因此它接受任何东西!因此,<video>...</video>标签不再被删除!
希望这有所帮助。
祝好,
-Christian

谢谢Christian,你的回答对我有很大帮助。 - Himanshu
这不仅仅是一个解决方法,而是一种安全漏洞。 - Drag and Drop
我看不到浏览按钮。还需要设置其他东西吗? - Ashish Joshi

0

下载插件后,在 ckeditor/plugin 中提取它, 然后进入 ckeditor.js 文件并找到 "CKEDITOR.config.plugins='",然后在其末尾添加 ",video"。

例如: CKEDITOR.config.plugins='dialogui,dialog,about,video'; 然后插件将正常工作。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接