plugin.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. (function(){
  2. //Section 1 : 按下自定义按钮时执行的代码
  3. var a= {
  4. exec:function(editor){
  5. var ctx=CKEDITOR.context;
  6. if(ctx==null & ctx==undefined)
  7. ctx="";
  8. var features = "dialogHeight:500px; dialogWidth:750px; status:no; scroll:auto; resizable:no; help:no; center:yes;";
  9. var url = jQuery.getContextPath()+ "/manage/file/getFile.ht?type=4";//type =4 为视频
  10. if(ctx!=="")
  11. url+="&ctx=" + ctx;
  12. var vReturnValue = window.showModalDialog(url, window,features);
  13. if (typeof (vReturnValue) == 'undefined'||vReturnValue==null) {
  14. vReturnValue = window.retureValue;
  15. }
  16. if (vReturnValue == undefined|| vReturnValue == 'undefined')vReturnValue = "";
  17. if(vReturnValue!=""){
  18. setTimeout(function()
  19. {
  20. editor.insertHtml(vReturnValue);
  21. }, 1);
  22. }
  23. }
  24. },
  25. //Section 2 : 创建自定义按钮、绑定方法
  26. b='video';
  27. CKEDITOR.plugins.add(b,{
  28. init:function(editor){
  29. editor.addCommand(b,a);
  30. editor.ui.addButton('video',{
  31. label:'插入视频',
  32. icon: this.path + 'cab.png',
  33. command:b
  34. });
  35. }
  36. });
  37. })();