multiimg.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. (function() {
  2. CKEDITOR.dialog.add("multiimg",
  3. function(a) {
  4. var ROOT_PATH = ""; // your root path
  5. return {
  6. title: "批量上传图片",
  7. minWidth: "660px",
  8. minHeight:"400px",
  9. contents: [{
  10. id: "tab1",
  11. label: "",
  12. title: "",
  13. expand: true,
  14. width: "420px",
  15. height: "300px",
  16. padding: 0,
  17. elements: [{
  18. type: "html",
  19. style: "width:660px;height:400px",
  20. html: '<iframe id="uploadFrame" src="'+ROOT_PATH+'ckeditor/plugins/multiimg/dialogs/image.html?v=' +new Date().getSeconds() + '" frameborder="0"></iframe>'
  21. }]
  22. }],
  23. onOk: function() {
  24. var ins = a;
  25. var num = window.imgs.length;
  26. var imgHtml = "";
  27. for(var i=0;i<num;i++){
  28. imgHtml += "<p><img src=\"" + window.imgs[i] + "\" /></p>";
  29. }
  30. ins.insertHtml(imgHtml);
  31. },
  32. onShow: function () {
  33. document.getElementById("uploadFrame").setAttribute("src",ROOT_PATH+"ckeditor/plugins/multiimg/dialogs/image.html?v=' +new Date().getSeconds() + '");
  34. }
  35. }
  36. })
  37. })();