configs.yml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. - name: "textarea"
  2. type: "jQuery Object / HTML Element / Selector String"
  3. default: "null"
  4. description: |
  5. The textarea element which Simditor will be created on.
  6. - name: "placeholder"
  7. type: "String"
  8. default: "''"
  9. description: |
  10. Placeholder of Simditor. Use the placeholder attribute value of the textarea by default.
  11. - name: "toolbar"
  12. type: "Boolean / Array"
  13. default: "true"
  14. description: |
  15. Show toolbar buttons. Accpect an array of buttons that includes:
  16. ```coffee
  17. [
  18. 'title'
  19. 'bold'
  20. 'italic'
  21. 'underline'
  22. 'strikethrough'
  23. 'fontScale'
  24. 'color'
  25. 'ol' # ordered list
  26. 'ul' # unordered list
  27. 'blockquote'
  28. 'code' # code block
  29. 'table'
  30. 'link'
  31. 'image'
  32. 'hr' # horizontal ruler
  33. 'indent'
  34. 'outdent'
  35. 'alignment'
  36. ]
  37. ```
  38. - name: "toolbarFloat"
  39. type: "Boolean"
  40. default: "true"
  41. description: |
  42. Fixed the toolbar on the top of the browser when scrolling.
  43. - name: "toolbarFloatOffset"
  44. type: "Number"
  45. default: 0
  46. description: |
  47. Top offset of the toolbar when fixed
  48. - name: "toolbarHidden"
  49. type: "Boolean"
  50. default: "false"
  51. description: |
  52. Hide the toolbar. Can not work together with `toolbarFloat`.
  53. - name: "defaultImage"
  54. type: "String"
  55. default: "images/image.png"
  56. description: |
  57. Default image placeholder. Used when inserting pictures in Simditor.
  58. - name: "tabIndent"
  59. type: "Boolean"
  60. default: "true"
  61. description: |
  62. Use 'tab' key to make an indent.
  63. - name: "params"
  64. type: "Object"
  65. default: "{ }"
  66. description: |
  67. Insert a hidden input in textarea to store params (key-value pairs). Usually used as the default params of the form. It will generate:
  68. ```html
  69. <input type="hidden" name="key" value="val" />
  70. ```
  71. - name: "upload"
  72. type: "Boolean / Object"
  73. default: "false"
  74. description: |
  75. Accept false or key/value pairs. Extra options for uploading images:
  76. * `url` upload api url;
  77. * `params` extra params sent to the server;
  78. * `fileKey` key of the file param;
  79. * `connectionCount` how many images can be uploaded simultaneously;
  80. * `leaveConfirm` messages will be shown if one leave the page while file is being uploaded;
  81. Default values of these options
  82. ```coffee
  83. editor = new Simditor
  84. textarea: $('#editor')
  85. upload:
  86. url: ''
  87. params: null
  88. fileKey: 'upload_file'
  89. connectionCount: 3
  90. leaveConfirm: 'Uploading is in progress, are you sure to leave this page?'
  91. ```
  92. JSON response after uploading complete:
  93. ```coffee
  94. {
  95. "success": true/false,
  96. "msg": "error message", # optional
  97. "file_path": "[real file path]"
  98. }
  99. ```
  100. - name: "pasteImage"
  101. type: "Boolean"
  102. default: "false"
  103. description: |
  104. Support uploading by pasting images from the clipboard. Work together with `upload` and only supported by Firefox and Chrome.
  105. - name: "cleanPaste"
  106. type: "Boolean"
  107. default: "false"
  108. description: |
  109. Remove all styles in paste content automatically.
  110. - name: "imageButton"
  111. type: "Array/String"
  112. default: "['upload', 'external']"
  113. description: |
  114. Insert images by uploading from the local computer or external links. If both are enabled, Simditor will show a drop-down menu when click the image button.
  115. - name: "allowedTags"
  116. type: "Array"
  117. default: "null"
  118. description: |
  119. Tags that are allowed in Simditor.
  120. Default whitelist:
  121. ```coffee
  122. ['br', 'span', 'a', 'img', 'b', 'strong', 'i', 'strike', 'u', 'font', 'p', 'ul', 'ol', 'li', 'blockquote', 'pre', 'code', 'h1', 'h2', 'h3', 'h4', 'hr']
  123. ```
  124. Note that custom whitelist will be merged into the default one.
  125. - name: "allowedAttributes"
  126. type: "Array"
  127. default: "null"
  128. description: |
  129. Whitelist of tag attributes. `style` attribute whitelist is defined in `allowedStyles`. Default whitelist:
  130. ```coffee
  131. img: ['src', 'alt', 'width', 'height', 'data-non-image']
  132. a: ['href', 'target']
  133. font: ['color']
  134. code: ['class']
  135. ```
  136. Note that custom whitelist will be merged into the default one.
  137. - name: "allowedStyles"
  138. type: "Array"
  139. default: "null"
  140. description: |
  141. Inline style whitelist. Default whitelist:
  142. ```coffee
  143. span: ['color', 'font-size']
  144. b: ['color']
  145. i: ['color']
  146. strong: ['color']
  147. strike: ['color']
  148. u: ['color']
  149. p: ['margin-left', 'text-align']
  150. h1: ['margin-left', 'text-align']
  151. h2: ['margin-left', 'text-align']
  152. h3: ['margin-left', 'text-align']
  153. h4: ['margin-left', 'text-align']
  154. ```
  155. Note that custom whitelist will be merged into the default one.
  156. - name: 'codeLanguages'
  157. type: 'Array'
  158. default: 'null'
  159. description: |
  160. A list of programming languages supported by code block. Default list:
  161. ```coffee
  162. [
  163. { name: 'Bash', value: 'bash' }
  164. { name: 'C++', value: 'c++' }
  165. { name: 'C#', value: 'cs' }
  166. { name: 'CSS', value: 'css' }
  167. { name: 'Erlang', value: 'erlang' }
  168. { name: 'Less', value: 'less' }
  169. { name: 'Sass', value: 'sass' }
  170. { name: 'Diff', value: 'diff' }
  171. { name: 'CoffeeScript', value: 'coffeescript' }
  172. { name: 'HTML,XML', value: 'html' }
  173. { name: 'JSON', value: 'json' }
  174. { name: 'Java', value: 'java' }
  175. { name: 'JavaScript', value: 'js' }
  176. { name: 'Markdown', value: 'markdown' }
  177. { name: 'Objective C', value: 'oc' }
  178. { name: 'PHP', value: 'php' }
  179. { name: 'Perl', value: 'parl' }
  180. { name: 'Python', value: 'python' }
  181. { name: 'Ruby', value: 'ruby' }
  182. { name: 'SQL', value: 'sql'}
  183. ]
  184. ```