今天,据同事编辑反馈,编辑器无法使用video标签,于是查看了一下问题,发过只要是放入video标签就会被自动过滤,查找原因后,在代码中做了如下修改
1、在编辑器目录下kindEditor-all.js 文件275行处增加html video标签 修改如下
htmlTags : { video: ['id', 'class', 'src', 'width', 'height', 'type', 'loop', 'autostart', 'quality', '.width', '.height', 'align', 'allowscriptaccess', 'controls'],
2、找到 function _mediaType(src)函数增加
if (/.(mp4)(?|$)/i.test(src)) { return 'video/mp4'; }
3、由于flash停止支持 将上传视频时的enable标签也替换成video,修改 _mediaEmbed函数
html = '<video '; _each(attrs, function(key, val){ if (key=='autostart' && val=='true') { html += "autoplay="autoplay""; } else if (key=='loop' && val=="true") { html += "loop="loop""; } else { html += key + '="' + val +'" '; } }) html += "controls="controls">您的浏览器太老了,不支持html5视频播放!请更换新的浏览器!</video>";