找到kindeditor.js文件
1.将video添加为不需要过滤过的标签
添加代码
video : ['id', 'class', 'src', 'width', 'height', 'type', 'loop', 'autostart', 'quality', '.width', '.height', 'align', 'allowscriptaccess','controls'],
搜索 htmlTags ,红框为具体添加位置
2.加上MP4视频类型
添加代码
if (/\.(mp4|mp5)(\?|$)/i.test(src)) { return 'video/mp4'; }
搜索 function _mediaType(src),红框为添加代码
3.根据视频类型判断
添加代码
// 一段简单的代码 解决视频上传问题 if (attrs.type=="video/mp4"){ var html = '<video '; _each(attrs, function(key, val) { html += key + '="' + val + '" '; }); html += 'controls="controls" />'; }
搜索function _mediaEmbed(attrs),红框为添加代码部分
以上三步完成后就能正常上传视频了。