修改源代码!
- 打开kindeditor-all.js,搜【K.options】,在里面htmlTags子项内加:
video : ['id', 'class', 'src', 'width', 'height', 'type', 'loop', 'autostart', 'quality', '.width', '.height', 'align', 'allowscriptaccess','controls'],
2. 再搜【_mediaType】函数,添加:
if (/\.(mp4)(\?|$)/i.test(src)) {
return 'video/mp4';
}
3. 接着搜【_mediaEmbed】函数,加代码:
if (attrs.type == 'video/mp4') {
var html = '<video ';
_each(attrs, function(key, val) {
html += key + '="' + val + '" ';
});
html += ' controls="controls" />';
}
- 最后搜【_mediaImg】函数,改成如下代码:
if (attrs.src.indexOf(".mp4") != -1) {
var html = "<video controls width="+width+" height="+height+" src='"+attrs.src+"'></video>";
return html;
} else {
var html = '<img class="' + _mediaClass(type) + '" src="' + blankPath + '" ';
if (style !== '') {
html += 'style="' + style + '" ';
}
html += 'data-ke-tag="' + escape(srcTag) + '" alt="" />';
}
- 最后,我使用的是Springboot来管理后台(后台自己写返回json数据),所以说到达这步基本完成了。让我们看看效果
转载自:http://www.workneed.com/index/help/detail/sid/394.html