upload.html 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Upload plugin | Trumbowyg by Alex-D</title>
  6. <link href='https://fonts.googleapis.com/css?family=Open+Sans:300,400' rel='stylesheet' type='text/css'>
  7. <link rel="stylesheet" href="../../css/main.css">
  8. </head>
  9. <body class="documentation-body">
  10. <div class="main main-demo-inner">
  11. <section class="wrapper section">
  12. <h2 class="section-title">Upload plugin</h2>
  13. <div class="feature">
  14. <h3>Basic usage</h3>
  15. <p>
  16. You can insert an image by upload.
  17. </p>
  18. <a href="../../documentation/plugins/#plugin-upload" class="button button-demo">Read upload plugin documentation</a>
  19. <div id="editor">
  20. <h2>Insert your uploaded image!</h2>
  21. <p>
  22. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Possimus, aliquam, minima fugiat placeat provident
  23. optio nam reiciendis eius beatae quibusdam!
  24. </p>
  25. <p>
  26. The text is derived from Cicero's De Finibus Bonorum et Malorum (On the Ends of Goods and Evils, or
  27. alternatively [About] The Purposes of Good and Evil ). The original passage began: Neque porro quisquam est
  28. qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit (Translation: &quot;Neither is there
  29. anyone who loves grief itself since it is grief and thus wants to obtain it&quot;).
  30. </p>
  31. </div>
  32. <h2>The code</h2>
  33. <pre><code class="js-code-to-eval javascript">
  34. $('#editor')
  35. .trumbowyg({
  36. btns: ['upload'],
  37. plugins: {
  38. // Add imagur parameters to upload plugin for demo purposes
  39. upload: {
  40. serverPath: 'https://api.imgur.com/3/image',
  41. fileFieldName: 'image',
  42. headers: {
  43. 'Authorization': 'Client-ID 9e57cb1c4791cea'
  44. },
  45. urlPropertyName: 'data.link'
  46. }
  47. }
  48. });
  49. </code></pre>
  50. </div>
  51. <div class="feature">
  52. <h3>Upload in dropdown</h3>
  53. <div id="editor-dropdown">
  54. <h2>Insert your uploaded image through image dropdown!</h2>
  55. <p>
  56. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Possimus, aliquam, minima fugiat placeat provident
  57. optio nam reiciendis eius beatae quibusdam!
  58. </p>
  59. <p>
  60. The text is derived from Cicero's De Finibus Bonorum et Malorum (On the Ends of Goods and Evils, or
  61. alternatively [About] The Purposes of Good and Evil ). The original passage began: Neque porro quisquam est
  62. qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit (Translation: &quot;Neither is there
  63. anyone who loves grief itself since it is grief and thus wants to obtain it&quot;).
  64. </p>
  65. </div>
  66. <h4>The code</h4>
  67. <pre><code class="js-code-to-eval javascript">
  68. $('#editor-dropdown')
  69. .trumbowyg({
  70. btnsDef: {
  71. // Create a new dropdown
  72. image: {
  73. dropdown: ['insertImage', 'upload'],
  74. ico: 'insertImage'
  75. }
  76. },
  77. // Redefine the button pane
  78. btns: [
  79. ['viewHTML'],
  80. ['formatting'],
  81. ['strong', 'em', 'del'],
  82. ['superscript', 'subscript'],
  83. ['link'],
  84. ['image'], // Our fresh created dropdown
  85. ['justifyLeft', 'justifyCenter', 'justifyRight', 'justifyFull'],
  86. ['unorderedList', 'orderedList'],
  87. ['horizontalRule'],
  88. ['removeformat'],
  89. ['fullscreen']
  90. ],
  91. plugins: {
  92. // Add imagur parameters to upload plugin for demo purposes
  93. upload: {
  94. serverPath: 'https://api.imgur.com/3/image',
  95. fileFieldName: 'image',
  96. headers: {
  97. 'Authorization': 'Client-ID 9e57cb1c4791cea'
  98. },
  99. urlPropertyName: 'data.link'
  100. }
  101. }
  102. });
  103. </code></pre>
  104. </div>
  105. <div class="feature">
  106. <h3>Setup</h3>
  107. <h4>In head tag</h4>
  108. <pre><code class="html loading-head">
  109. </code></pre>
  110. <h4>At the end of body</h4>
  111. <pre><code class="html loading-body">
  112. &lt;!-- Import jQuery -->
  113. &lt;script src="//ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js">&lt;/script>
  114. &lt;script>window.jQuery || document.write('&lt;script src="js/vendor/jquery-3.2.1.min.js">&lt;\/script>')&lt;/script>
  115. </code></pre>
  116. </div>
  117. </section>
  118. </div>
  119. <!-- Import jQuery -->
  120. <script src="//ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  121. <script>window.jQuery || document.write('<script src="../../js/vendor/jquery-3.2.1.min.js"><\/script>')</script>
  122. <!-- DO NOT COPY THIS LINES IN YOUR PROJECT, THEY ARE THERE JUST FOR THE EXAMPLE PAGE PRUPOSE -->
  123. <script src="../js/loader.js"></script>
  124. <script>
  125. loadStyle('dist/ui/trumbowyg.css');
  126. loadScript('dist/trumbowyg.js', 'Import Trumbowyg');
  127. loadScript('dist/plugins/upload/trumbowyg.upload.js', 'Import all plugins you want AFTER importing jQuery and Trumbowyg');
  128. </script>
  129. <script src="../js/runExampleCode.js"></script>
  130. <script src="../js/highlight.js"></script>
  131. </body>
  132. </html>