- config.extraPlugins = 'capture,video';
- CKEDITOR.plugins.add('video', {
- init: function(editor) {
- //plugin code goes here
- var pluginName = 'video';
- CKEDITOR.dialog.add('video', function(a) {
- var b = a.config;
- var escape = function(value) {
- return value;
- };
- return {
- title: '插入MP4视频',
- resizable: CKEDITOR.DIALOG_RESIZE_BOTH,
- minWidth: 350,
- minHeight: 200,
- contents: [{
- id: 'info',
- label: '常规',
- accessKey: 'P',
- elements: [{
- type: 'hbox',
- widths: ['80%', '20%'],
- children: [{
- id: 'src',
- type: 'text',
- label: '源文件'
- }, {
- type: 'button',
- id: 'browse',
- filebrowser: 'info:src',
- hidden: true,
- align: 'center',
- label: '浏览服务器'
- }]
- }]
- }, {
- id: 'Upload',
- hidden: true,
- filebrowser: 'uploadButton',
- label: '上传视频',
- elements: [{
- type: 'file',
- id: 'upload',
- label: '上传视频',
- size: 38
- }, {
- type: 'fileButton',
- id: 'uploadButton',
- label: '上传到服务器上',
- filebrowser: 'info:src',
- 'for': ['Upload', 'upload'] //'page_id', 'element_id'
- }]
- }],
- onOk: function() {
- mysrc = this.getValueOf('info', 'src');
- html = '' + escape(mysrc) + '';
- a.insertHtml("<video src="" + html + "" controls="controls">您的浏览器版本过低,请先升级。</video>");
- },
- onLoad: function() { }
- };
- });
- editor.addCommand(pluginName, new CKEDITOR.dialogCommand(pluginName));
- editor.ui.addButton('video', {
- label: '插入mp4视频',
- command: pluginName,
- icon: this.path + 'icon.png'
- });
- }
- });
- ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],['ShowBlocks'],['Image','Capture','video'],['Maximize'],
本文转自:https://blog.csdn.net/wang178yang/article/details/89601231
希望以上内容对你有所帮助!如果还有其他问题,请随时提问。 各类知识收集 拥有多年CMS企业建站经验,对 lecms, classcms, fastadmin, pbootcms, phpcms, eyoucms, yzmcms, PHP, xunruicms, jizhicms, dedecms, wordpress, hkcms, yzncms, 等各类cms的相互转化,程序开发,网站制作,bug修复,程序杀毒,插件定制都可以提供最佳解决方案。