image-dialog.html 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8" />
  5. <title>ImageDialog Examples</title>
  6. <link rel="stylesheet" href="../themes/default/default.css" />
  7. <script src="../kindeditor.js"></script>
  8. <script src="../lang/zh_CN.js"></script>
  9. <script>
  10. KindEditor.ready(function(K) {
  11. var editor = K.editor({
  12. allowFileManager : true
  13. });
  14. K('#image1').click(function() {
  15. editor.loadPlugin('image', function() {
  16. editor.plugin.imageDialog({
  17. imageUrl : K('#url1').val(),
  18. clickFn : function(url, title, width, height, border, align) {
  19. K('#url1').val(url);
  20. editor.hideDialog();
  21. }
  22. });
  23. });
  24. });
  25. K('#image2').click(function() {
  26. editor.loadPlugin('image', function() {
  27. editor.plugin.imageDialog({
  28. showLocal : false,
  29. imageUrl : K('#url2').val(),
  30. clickFn : function(url, title, width, height, border, align) {
  31. K('#url2').val(url);
  32. editor.hideDialog();
  33. }
  34. });
  35. });
  36. });
  37. K('#image3').click(function() {
  38. editor.loadPlugin('image', function() {
  39. editor.plugin.imageDialog({
  40. showRemote : false,
  41. imageUrl : K('#url3').val(),
  42. clickFn : function(url, title, width, height, border, align) {
  43. K('#url3').val(url);
  44. editor.hideDialog();
  45. }
  46. });
  47. });
  48. });
  49. });
  50. </script>
  51. </head>
  52. <body>
  53. <p><input type="text" id="url1" value="" /> <input type="button" id="image1" value="选择图片" />(网络图片 + 本地上传)</p>
  54. <p><input type="text" id="url2" value="" /> <input type="button" id="image2" value="选择图片" />(网络图片)</p>
  55. <p><input type="text" id="url3" value="" /> <input type="button" id="image3" value="选择图片" />(本地上传)</p>
  56. </body>
  57. </html>